1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 13:06:01 +01:00

tests/functional: Output an actually correct command to accept test changes

I've run into this quite a few times when working with characterization test
infra. It would print an invalid command:

_NIX_TEST_ACCEPT=1 meson test main/lang

Which you'd then proceed to run and it would fail. This commit makes it
be honest about the command you need to run:

_NIX_TEST_ACCEPT=1 meson test --suite main lang
This commit is contained in:
Sergei Zimmerman 2025-11-09 16:52:51 +03:00
parent 479b6b73a9
commit 98e61c6da9
No known key found for this signature in database
3 changed files with 5 additions and 3 deletions

View file

@ -71,7 +71,7 @@ function characterisationTestExit() {
echo >&2 ''
echo >&2 'You can rerun this test with:'
echo >&2 ''
echo >&2 " _NIX_TEST_ACCEPT=1 meson test ${TEST_NAME}"
echo >&2 " _NIX_TEST_ACCEPT=1 meson test --suite ${TEST_SUITE_NAME} ${TEST_NAME}"
echo >&2 ''
echo >&2 'to regenerate the files containing the expected output,'
echo >&2 'and then view the git diff to decide whether a change is'

View file

@ -1,4 +1,5 @@
# shellcheck shell=bash
TEST_ROOT=$(realpath "${TMPDIR:-/tmp}/nix-test")/${TEST_NAME:-default/tests\/functional//}
TEST_SUBDIR="${TEST_SUITE_NAME:-default}/${TEST_NAME:-tests/functional/}"
TEST_ROOT=$(realpath "${TMPDIR:-/tmp}/nix-test")/"$TEST_SUBDIR"
export TEST_ROOT

View file

@ -263,7 +263,8 @@ foreach suite : suites
'ASAN_OPTIONS' : asan_options,
'_NIX_TEST_SOURCE_DIR' : meson.current_source_dir(),
'_NIX_TEST_BUILD_DIR' : meson.current_build_dir(),
'TEST_NAME' : suite_name / name,
'TEST_SUITE_NAME' : suite_name,
'TEST_NAME' : name,
'NIX_REMOTE' : '',
'PS4' : '+(${BASH_SOURCE[0]-$0}:$LINENO) ',
},