buildman: Perform tests in /tmp
PATCH 1/3 buildman: Perform tests in /tmp
We may not always be able to write to the default output directory but we will always have a usable /tmp. Make the buildman tests use /tmp
--- tools/buildman/func_test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
tools/buildman/func_test.py +12 -12
@@ -421,7 +421,7 @@ class TestFunctional(unittest.TestCase): def testCurrentSource(self): """Very simple test to invoke buildman on the current source""" self.setupToolchains(); - self._RunControl() + self._RunControl('-o', '/tmp') lines = terminal.GetPrintTestLines() self.assertIn('Building current source for %d boards' % len(boards), lines[0].text)
@@ -434,7 +434,7 @@ class TestFunctional(unittest.TestCase): def testBadToolchain(self): """Test that missing toolchains are detected""" self.setupToolchains(); - ret_code = self._RunControl('-b', TEST_BRANCH) + ret_code = self._RunControl('-b', TEST_BRANCH, '-o', '/tmp') lines = terminal.GetPrintTestLines() # Buildman always builds the upstream commit as well
@@ -458,13 +458,13 @@ class TestFunctional(unittest.TestCase): def testBranch(self): """Test building a branch with all toolchains present""" - self._RunControl('-b', TEST_BRANCH) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp') self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._builder.fail, 0) def testCount(self): """Test building a specific number of commitst""" - self._RunControl('-b', TEST_BRANCH, '-c2') + self._RunControl('-b', TEST_BRANCH, '-c2', '-o', '/tmp') self.assertEqual(self._builder.count, 2 * len(boards)) self.assertEqual(self._builder.fail, 0) # Each board has a mrproper, config, and then one make per commit
@@ -472,34 +472,34 @@ class TestFunctional(unittest.TestCase): def testIncremental(self): """Test building a branch twice - the second time should do nothing""" - self._RunControl('-b', TEST_BRANCH) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp') # Each board has a mrproper, config, and then one make per commit self.assertEqual(self._make_calls, len(boards) * (self._commits + 2)) self._make_calls = 0 - self._RunControl('-b', TEST_BRANCH, clean_dir=False) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp', clean_dir=False) self.assertEqual(self._make_calls, 0) self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._builder.fail, 0) def testForceBuild(self): """The -f flag should force a rebuild""" - self._RunControl('-b', TEST_BRANCH) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp') self._make_calls = 0 - self._RunControl('-b', TEST_BRANCH, '-f', clean_dir=False) + self._RunControl('-b', TEST_BRANCH, '-f', '-o', '/tmp', clean_dir=False) # Each board has a mrproper, config, and then one make per commit self.assertEqual(self._make_calls, len(boards) * (self._commits + 2)) def testForceReconfigure(self): """The -f flag should force a rebuild""" - self._RunControl('-b', TEST_BRANCH, '-C') + self._RunControl('-b', TEST_BRANCH, '-C', '-o', '/tmp') # Each commit has a mrproper, config and make self.assertEqual(self._make_calls, len(boards) * self._commits * 3) def testErrors(self): """Test handling of build errors""" self._error['board2', 1] = 'fred\n' - self._RunControl('-b', TEST_BRANCH) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp') self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._builder.fail, 1)
@@ -507,13 +507,13 @@ class TestFunctional(unittest.TestCase): # not be rebuilt del self._error['board2', 1] self._make_calls = 0 - self._RunControl('-b', TEST_BRANCH, clean_dir=False) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp', clean_dir=False) self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._make_calls, 0) self.assertEqual(self._builder.fail, 1) # Now use the -F flag to force rebuild of the bad commit - self._RunControl('-b', TEST_BRANCH, '-F', clean_dir=False) + self._RunControl('-b', TEST_BRANCH, '-o', '/tmp', '-F', clean_dir=False) self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._builder.fail, 0) self.assertEqual(self._make_calls, 3)
Signature · 1 line
2.17.1
PATCH 2/3 gitlab-ci: Have buildman use /tmp for output
When running as another user we might not be able to use '..' for certain directories and this is the default for buildman. Specify an output directory instead.
--- .gitlab-ci.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
.gitlab-ci.yml +13 -13
@@ -36,9 +36,9 @@ stages: # use clang only do one configuration. - if [[ "${BUILDMAN}" != "" ]]; then ret=0; - tools/buildman/buildman -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?; + tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then - tools/buildman/buildman -sdeP ${BUILDMAN}; + tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN}; exit $ret; fi; fi
@@ -46,7 +46,7 @@ stages: # never prevent any test from running. That way, we can always pass # "-k something" even when $TEST_PY_TEST_SPEC doesnt need a custom # value. - - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/${TEST_PY_BD}; + - export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/${TEST_PY_BD}; export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:/usr/bin:/bin; export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci; if [[ "${TEST_PY_BD}" != "" ]]; then
@@ -64,9 +64,9 @@ build all 32bit ARM plaforms: stage: world build script: - ret=0; - ./tools/buildman/buildman -P -E arm -x aarch64 || ret=$?; + ./tools/buildman/buildman -o /tmp -P -E arm -x aarch64 || ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then - ./tools/buildman/buildman -sdeP; + ./tools/buildman/buildman -o /tmp -sdeP; exit $ret; fi;
@@ -78,9 +78,9 @@ build all 64bit ARM plaforms: - . /tmp/venv/bin/activate - pip install pyelftools - ret=0; - ./tools/buildman/buildman -P -E aarch64 || ret=$?; + ./tools/buildman/buildman -o /tmp -P -E aarch64 || ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then - ./tools/buildman/buildman -sdeP; + ./tools/buildman/buildman -o /tmp -sdeP; exit $ret; fi;
@@ -89,9 +89,9 @@ build all PowerPC plaforms: stage: world build script: - ret=0; - ./tools/buildman/buildman -P -E powerpc || ret=$?; + ./tools/buildman/buildman -o /tmp -P -E powerpc || ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then - ./tools/buildman/buildman -sdeP; + ./tools/buildman/buildman -o /tmp -sdeP; exit $ret; fi;
@@ -100,9 +100,9 @@ build all other plaforms: stage: world build script: - ret=0; - ./tools/buildman/buildman -P -E -x arm,powerpc || ret=$?; + ./tools/buildman/buildman -o /tmp -P -E -x arm,powerpc || ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then - ./tools/buildman/buildman -sdeP; + ./tools/buildman/buildman -o /tmp -sdeP; exit $ret; fi;
@@ -162,10 +162,10 @@ Run binman, buildman, dtoc and patman testsuites: virtualenv /tmp/venv; . /tmp/venv/bin/activate; pip install pyelftools; - export UBOOT_TRAVIS_BUILD_DIR=`cd .. && pwd`/.bm-work/sandbox_spl; + export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl; export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"; export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"; - ./tools/buildman/buildman -P sandbox_spl; + ./tools/buildman/buildman -o /tmp -P sandbox_spl; ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test; ./tools/buildman/buildman -t; ./tools/dtoc/dtoc -t;
Signature · 1 line
2.17.1
PATCH 2/3 gitlab-ci: Have buildman use /tmp for output
Quoted 3 lines · Tom Rini
When running as another user we might not be able to use '..' for certain directories and this is the default for buildman. Specify an output directory instead.
What if multiple invocations run in parallel on the same machine? They'll use the same path and collide. What about using mkdtemp() or similar?
PATCH 2/3 gitlab-ci: Have buildman use /tmp for output
Quoted 7 lines · Stephen Warren
Quoted 3 lines · Tom Rini
When running as another user we might not be able to use '..' for certain directories and this is the default for buildman. Specify an output directory instead.
What if multiple invocations run in parallel on the same machine? They'll use the same path and collide. What about using
mkdtemp()or similar?
Within the confines of gitlab (as this runs in a container), that's not possible and this is no less safe than today.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191004/8bf566a7/attachment.sig>
PATCH 2/3 gitlab-ci: Have buildman use /tmp for output
In reply to Tom RiniQuoted 5 lines · Tom Rini
When running as another user we might not be able to use '..' for certain directories and this is the default for buildman. Specify an output directory instead.
Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191008/9b8bffa8/attachment.sig>
PATCH 3/3 gitlab-ci: Switch to Ubuntu 18.04 image
In reply to Tom RiniIn order to run all filesystem tests we need to have newer ext4 tools, move up to Ubuntu 18.04 'bionic' for our base. We need to change slightly how we invoke the provided grub-mkimage. This will also make future python3 work easier.
--- .gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
.gitlab-ci.yml +4 -3
@@ -2,7 +2,7 @@ # Grab our configured image. The source for this is found at: # https://gitlab.denx.de/u-boot/gitlab-ci-runner -image: trini/u-boot-gitlab-ci-runner:xenial-20190720-02Aug2019 +image: trini/u-boot-gitlab-ci-runner:bionic-20190912.1-03Oct2019 # We run some tests in different order, to catch some failures quicker. stages:
@@ -22,8 +22,9 @@ stages: - . /tmp/venv/bin/activate - pip install pytest==2.8.7 - pip install python-subunit - - grub-mkimage -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - - grub-mkimage -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + - pip install coverage + - grub-mkimage --prefix="" -o ~/grub_x86.efi -O i386-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd + - grub-mkimage --prefix="" -o ~/grub_x64.efi -O x86_64-efi normal echo lsefimmap lsefi lsefisystab efinet tftp minicmd - mkdir ~/grub2-arm - ( cd ~/grub2-arm; wget -O - http://download.opensuse.org/ports/armv7hl/distribution/leap/42.2/repo/oss/suse/armv7hl/grub2-arm-efi-2.02~beta2-87.1.armv7hl.rpm | rpm2cpio | cpio -di ) - mkdir ~/grub2-arm64
Signature · 1 line
2.17.1
PATCH 3/3 gitlab-ci: Switch to Ubuntu 18.04 image
Quoted 6 lines · Tom Rini
In order to run all filesystem tests we need to have newer ext4 tools, move up to Ubuntu 18.04 'bionic' for our base. We need to change slightly how we invoke the provided grub-mkimage. This will also make future python3 work easier.
Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191008/0df0d57c/attachment.sig>
PATCH 1/3 buildman: Perform tests in /tmp
In reply to Tom RiniQuoted 2 lines · Tom Rini
We may not always be able to write to the default output directory but we will always have a usable /tmp.
Is that a valid assumption? Surely $TMPDIR should be used if set in the environment, falling back to a hard-coded /tmp if that isn't set?
PATCH 1/3 buildman: Perform tests in /tmp
Quoted 6 lines · Stephen Warren
Quoted 2 lines · Tom Rini
We may not always be able to write to the default output directory but we will always have a usable /tmp.
Is that a valid assumption? Surely $TMPDIR should be used if set in the environment, falling back to a hard-coded /tmp if that isn't set?
$TMPDIR is most portable but as far as Linux goes, there needs to be /tmp, yes?
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191004/a0ac4bd3/attachment.sig>
PATCH 1/3 buildman: Perform tests in /tmp
Quoted 10 lines · Tom Rini
Quoted 6 lines · Stephen Warren
Quoted 2 lines · Tom Rini
We may not always be able to write to the default output directory but we will always have a usable /tmp.
Is that a valid assumption? Surely $TMPDIR should be used if set in the environment, falling back to a hard-coded /tmp if that isn't set?
$TMPDIR is most portable but as far as Linux goes, there needs to be /tmp, yes?
I don't think there absolutely has to be, no. Calling tempfile.mkdtemp() will "just work" and do the right thing in all cases.
PATCH 1/3 buildman: Perform tests in /tmp
Quoted 6 lines · Stephen Warren
Quoted 5 lines · Tom Rini
Quoted 4 lines · Stephen Warren
Quoted 2 lines · Tom Rini
We may not always be able to write to the default output directory but we will always have a usable /tmp.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Is that a valid assumption? Surely $TMPDIR should be used if set in the environment, falling back to a hard-coded /tmp if that isn't set?
$TMPDIR is most portable but as far as Linux goes, there needs to be /tmp, yes?
I don't think there absolutely has to be, no. Calling
tempfile.mkdtemp()will "just work" and do the right thing in all cases.
OK, that wasn't too bad, waiting for any other feedback before v2'ing, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191004/d1cae8be/attachment.sig>
PATCH 1/3 buildman: Perform tests in /tmp
In reply to Tom RiniQuoted 9 lines · Tom Rini
We may not always be able to write to the default output directory but we will always have a usable /tmp. Make the buildman tests use /tmp
Cc Simon Glass <[email protected]>Signed-off-by Tom Rini <[email protected]>--- tools/buildman/func_test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
(this, or using $TMPDIR)