Skip to content

Commit 98e61c6

Browse files
committed
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
1 parent 479b6b7 commit 98e61c6

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

tests/functional/characterisation/framework.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function characterisationTestExit() {
7171
echo >&2 ''
7272
echo >&2 'You can rerun this test with:'
7373
echo >&2 ''
74-
echo >&2 " _NIX_TEST_ACCEPT=1 meson test ${TEST_NAME}"
74+
echo >&2 " _NIX_TEST_ACCEPT=1 meson test --suite ${TEST_SUITE_NAME} ${TEST_NAME}"
7575
echo >&2 ''
7676
echo >&2 'to regenerate the files containing the expected output,'
7777
echo >&2 'and then view the git diff to decide whether a change is'
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# shellcheck shell=bash
22

3-
TEST_ROOT=$(realpath "${TMPDIR:-/tmp}/nix-test")/${TEST_NAME:-default/tests\/functional//}
3+
TEST_SUBDIR="${TEST_SUITE_NAME:-default}/${TEST_NAME:-tests/functional/}"
4+
TEST_ROOT=$(realpath "${TMPDIR:-/tmp}/nix-test")/"$TEST_SUBDIR"
45
export TEST_ROOT

tests/functional/meson.build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ foreach suite : suites
263263
'ASAN_OPTIONS' : asan_options,
264264
'_NIX_TEST_SOURCE_DIR' : meson.current_source_dir(),
265265
'_NIX_TEST_BUILD_DIR' : meson.current_build_dir(),
266-
'TEST_NAME' : suite_name / name,
266+
'TEST_SUITE_NAME' : suite_name,
267+
'TEST_NAME' : name,
267268
'NIX_REMOTE' : '',
268269
'PS4' : '+(${BASH_SOURCE[0]-$0}:$LINENO) ',
269270
},

0 commit comments

Comments
 (0)