Skip to content

Commit 3776faf

Browse files
committed
testsuite: fix a couple tests in t0100-modprobe.t
Problem: A couple of tests in t0100-modprobe.t use `libexecdir` as the expected path to `modprobe.d`, but this should be `datadir`. This works for the build tree since `libexecdir` == `datadir`, but will fail when testing installed Flux. Additionally, use of `$(pwd)` as a search path entry may not be failsafe, since there is a chance a different path could be printed by modprobe, e.g. in the case of a symlink. Fix these issues by using `datadir` for expected paths to modprobe TOML files, and an explicit fake path in place of `$(pwd)` when matching exact paths in output. Additionally, add more useful debug output to these tests.
1 parent 31459ee commit 3776faf

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

t/t0100-modprobe.t

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -545,20 +545,27 @@ test_expect_success 'modprobe fails if task raises exception' '
545545
grep "next:.*test exception" output${seq}
546546
'
547547
test_expect_success 'modprobe: FLUX_MODPROBE_PATH works' '
548-
FLUX_MODPROBE_PATH=$(pwd) \
548+
FLUX_MODPROBE_PATH=/test/path \
549549
flux modprobe rc1 --dry-run --verbose >path.out 2>&1 &&
550-
grep "checking $(pwd)" path.out &&
550+
test_debug "echo libexecdir=$(flux config builtin libexecdir)" &&
551+
test_debug "echo datadir=$(flux config builtin datadir)" &&
552+
test_debug "grep checking path.out" &&
553+
test_debug "echo =-=-=" &&
554+
grep "checking /test/path/modprobe" path.out &&
551555
test_must_fail \
552-
grep $(flux config builtin libexecdir)/modprobe/modprobe.d path.out &&
556+
grep $(flux config builtin datadir)/modprobe/modprobe.d path.out &&
553557
test_must_fail \
554558
grep $(flux config builtin libexecdir)/modprobe/rc1.d path.out
555559
'
556560
test_expect_success 'modprobe: FLUX_MODPROBE_PATH_APPEND works' '
557-
FLUX_MODPROBE_PATH_APPEND=$(pwd) \
561+
FLUX_MODPROBE_PATH_APPEND=/test/path \
558562
flux modprobe rc1 --dry-run --verbose >path-append.out 2>&1 &&
559-
test_debug "cat path-append.out" &&
560-
grep "checking $(pwd)" path-append.out &&
561-
grep $(flux config builtin libexecdir)/modprobe/modprobe.d path-append.out &&
563+
test_debug "echo libexecdir=$(flux config builtin libexecdir)" &&
564+
test_debug "echo datadir=$(flux config builtin datadir)" &&
565+
test_debug "grep checking path-append.out" &&
566+
test_debug "echo =-=-=" &&
567+
grep "checking /test/path/modprobe" path-append.out &&
568+
grep $(flux config builtin datadir)/modprobe/modprobe.d path-append.out &&
562569
grep $(flux config builtin libexecdir)/modprobe/rc1.d path-append.out
563570
'
564571
test_expect_success 'modprobe: detects missing required modprobe.toml keys' '

0 commit comments

Comments
 (0)