]> git.ipfire.org Git - thirdparty/elfutils.git/commit
tests: Create random test_dir name
authorMark Wielaard <mark@klomp.org>
Tue, 6 May 2025 09:50:12 +0000 (11:50 +0200)
committerMark Wielaard <mark@klomp.org>
Tue, 13 May 2025 19:21:34 +0000 (21:21 +0200)
commit8d996450d6b88730dc2e8f95374b2cc683a52e0c
treed2a4599918f1fba480f2bfc12d67ff39c4eecfb3
parent13148250ce0e27cc8145f6ddaa8339f08a5ef993
tests: Create random test_dir name

The testsuite relies on there being no files in the test directory
after the test finishes. A test will fail if the test dir cannot be
removed. But the test dir isn't really random, it uses the pid of the
shell script that executes the test. On some of the buildbots that
execute a lot of tests it can happen that the pid number wraps around
and a pid of a previous pid is reused. To prevent that happening
generate a real random number (8 bytes) using od /dev/urandom and
xargs (to trim away spaces left by od).

      * tests/test-subr.sh: Define test_name and random_number and use
      those to define test_dir.

Signed-off-by: Mark Wielaard <mark@klomp.org>
tests/test-subr.sh