mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 15:10:14 +01:00
gitlab-ci: fix randomizing tests in "nm-ci-run.sh"
The code was just wrong. Usually in gitlab-ci, NMTST_SEED_RANDOM is unset, so the previous code would not have set it. Which means that our tests run with NMTST_SEED_RANDOM="0". Fuzzing (or randomizing tests) is very useful, we should do that for the unit tests that run in gitlab-ci. Fix this. But don't let the test choose a random number. Instead, let the calling script choose it. That is, because we might run the tests more than once (without debugging and no valgrind; in case of failure return with debugging; with valgrind). Those runs should use the same seed. This fixes commit70487d9ff8('ci: randomize tests during our CI'), but as fixing randomization can break previously running tests, we may only want to backport this commit after careful evaluation. (cherry picked from commit3bad3f8b24)
This commit is contained in:
parent
dc588c951c
commit
a15ff56ec7
1 changed files with 6 additions and 2 deletions
|
|
@ -69,9 +69,13 @@ if [ $IS_ALPINE = 1 ]; then
|
|||
_WITH_SYSTEMD_LOGIND="$_FALSE"
|
||||
fi
|
||||
|
||||
if [ "$NMTST_SEED_RAND" != "" ]; then
|
||||
export NMTST_SEED_RAND=
|
||||
if [ -z "${NMTST_SEED_RAND+x}" ]; then
|
||||
NMTST_SEED_RAND="$SRANDOM"
|
||||
if [ -z "$NMTST_SEED_RAND" ]; then
|
||||
NMTST_SEED_RAND="$(( ( (RANDOM<<15|RANDOM)<<15|RANDOM ) % 0xfffffffe ))"
|
||||
fi
|
||||
fi
|
||||
export NMTST_SEED_RAND
|
||||
|
||||
case "$CI" in
|
||||
""|"true"|"default"|"gitlab")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue