aboutsummaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2020-10-11 17:17:28 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2020-10-13 00:30:31 +0200
commitf6b346f2e269fea7c39fa998f28d377c8481e8d9 (patch)
treeb3ed1247ec72d99335f40d0f6dc0a320f24c2ca6 /ci
parenteef880f509255a43e53fc9ed04e9e6bcf6ac98bc (diff)
downloadmeson-f6b346f2e269fea7c39fa998f28d377c8481e8d9.zip
meson-f6b346f2e269fea7c39fa998f28d377c8481e8d9.tar.gz
meson-f6b346f2e269fea7c39fa998f28d377c8481e8d9.tar.bz2
ci: Add an interactive mode (testTTY) for the CI image builder
Diffstat (limited to 'ci')
-rw-r--r--ci/ciimage/.gitignore1
-rwxr-xr-xci/ciimage/arch/install.sh2
-rwxr-xr-xci/ciimage/build.py35
3 files changed, 29 insertions, 9 deletions
diff --git a/ci/ciimage/.gitignore b/ci/ciimage/.gitignore
index 02a0319..cff1864 100644
--- a/ci/ciimage/.gitignore
+++ b/ci/ciimage/.gitignore
@@ -1,2 +1,3 @@
/build_*
/test_*
+/user.sh
diff --git a/ci/ciimage/arch/install.sh b/ci/ciimage/arch/install.sh
index fb27c26..1e1ad0c 100755
--- a/ci/ciimage/arch/install.sh
+++ b/ci/ciimage/arch/install.sh
@@ -26,7 +26,7 @@ PACMAN_OPTS='--needed --noprogressbar --noconfirm'
# Patch config files
sed -i 's/#Color/Color/g' /etc/pacman.conf
sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
-sed -i "s,PKGEXT='.pkg.tar.xz',PKGEXT='.pkg.tar',g" /etc/makepkg.conf
+sed -i "s,PKGEXT='.pkg.tar.zst',PKGEXT='.pkg.tar',g" /etc/makepkg.conf
# Install packages
pacman -Syu $PACMAN_OPTS "${pkgs[@]}"
diff --git a/ci/ciimage/build.py b/ci/ciimage/build.py
index e623a7e..dcc11a9 100755
--- a/ci/ciimage/build.py
+++ b/ci/ciimage/build.py
@@ -140,12 +140,13 @@ class ImageTester(BuilderBase):
ignore=shutil.ignore_patterns(
'.git',
'*_cache',
- 'work area',
+ '__pycache__',
+ # 'work area',
self.temp_dir.name,
)
)
- def do_test(self):
+ def do_test(self, tty: bool = False) -> None:
self.copy_meson()
self.gen_dockerfile()
@@ -158,11 +159,26 @@ class ImageTester(BuilderBase):
if subprocess.run(build_cmd).returncode != 0:
raise RuntimeError('Failed to build the test docker image')
- test_cmd = [
- self.docker, 'run', '--rm', '-t', 'meson_test_image',
- '/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py $CI_ARGS'
- ]
- if subprocess.run(test_cmd).returncode != 0:
+ test_cmd = []
+ if tty:
+ test_cmd = [
+ self.docker, 'run', '--rm', '-t', '-i', 'meson_test_image',
+ '/bin/bash', '-c', ''
+ + 'cd meson;'
+ + 'source /ci/env_vars.sh;'
+ + f'echo -e "\\n\\nInteractive test shell in the {image_namespace}/{self.data_dir.name} container with the current meson tree";'
+ + 'echo -e "The file ci/ciimage/user.sh will be sourced if it exists to enable user specific configurations";'
+ + 'echo -e "Run the following command to run all CI tests: ./run_tests.py $CI_ARGS\\n\\n";'
+ + '[ -f ci/ciimage/user.sh ] && exec /bin/bash --init-file ci/ciimage/user.sh;'
+ + 'exec /bin/bash;'
+ ]
+ else:
+ test_cmd = [
+ self.docker, 'run', '--rm', '-t', 'meson_test_image',
+ '/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py $CI_ARGS'
+ ]
+
+ if subprocess.run(test_cmd).returncode != 0 and not tty:
raise RuntimeError('Running tests failed')
finally:
cleanup_cmd = [self.docker, 'rmi', '-f', 'meson_test_image']
@@ -171,7 +187,7 @@ class ImageTester(BuilderBase):
def main() -> None:
parser = argparse.ArgumentParser(description='Meson CI image builder')
parser.add_argument('what', type=str, help='Which image to build / test')
- parser.add_argument('-t', '--type', choices=['build', 'test'], help='What to do', required=True)
+ parser.add_argument('-t', '--type', choices=['build', 'test', 'testTTY'], help='What to do', required=True)
args = parser.parse_args()
@@ -188,6 +204,9 @@ def main() -> None:
elif args.type == 'test':
tester = ImageTester(ci_data, ci_build, ci_root)
tester.do_test()
+ elif args.type == 'testTTY':
+ tester = ImageTester(ci_data, ci_build, ci_root)
+ tester.do_test(tty=True)
if __name__ == '__main__':
main()