From 9ede5d68748319bb89acc06358523043e315ef08 Mon Sep 17 00:00:00 2001 From: Mark Grondona Date: Thu, 31 Aug 2017 14:37:56 +0000 Subject: [PATCH] t0001-basic.t: add test for module unload failure detection Add a test to detect that test_under_flux can detect when modules loaded during testing are not unloaded after test_done. --- t/t0001-basic.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/t/t0001-basic.t b/t/t0001-basic.t index 9e52f948c9e4..c9ef42d74695 100755 --- a/t/t0001-basic.t +++ b/t/t0001-basic.t @@ -120,6 +120,35 @@ test_expect_success 'test_under_flux works' ' ) && grep "size=2" test-under-flux/out ' + +test_expect_success 'test_under_flux fails if loaded modules are not unloaded' ' + mkdir -p test-under-flux && ( + cd test-under-flux && + cat >.test.modcheck.t <<-EOF && + #!/bin/sh + test_description="test_under_flux with module loaded, but not unloaded" + . "\$SHARNESS_TEST_SRCDIR"/sharness.sh + test_under_flux 2 minimal + test_expect_success "flux module load kvs" " + flux module load -r 0 kvs + " + test_done + EOF + chmod +x .test.modcheck.t && + SHARNESS_TEST_DIRECTORY=`pwd` && + export SHARNESS_TEST_SRCDIR SHARNESS_TEST_DIRECTORY FLUX_BUILD_DIR debug && + test_expect_code 1 ./.test.modcheck.t 2>err.modcheck \ + | grep -v sharness: >out.modcheck + ) && + cat >expected.modcheck <<-EOF && + ok 1 - flux module load kvs + # passed all 1 test(s) + 1..1 + error: manually loaded module(s) not unloaded: kvs + EOF + test_cmp expected.modcheck test-under-flux/out.modcheck +' + test_expect_success 'flux-start -o,--setattr ATTR=VAL can set broker attributes' ' ATTR_VAL=`flux start ${ARGS} -o,--setattr=foo-test=42 flux getattr foo-test` && test $ATTR_VAL -eq 42