Skip to content

Commit

Permalink
Merge pull request #1167 from grondo/chain-lint
Browse files Browse the repository at this point in the history
testsuite: revert travis-ci to vm builds and fix many broken &&-chains in tests
  • Loading branch information
garlick authored Aug 29, 2017
2 parents 1c99b02 + 3341f7c commit 820301e
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 173 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: c

sudo: false
sudo: true

compiler:
- gcc
Expand All @@ -15,7 +15,7 @@ matrix:
- compiler: clang
env: CPPCHECK=t ARGS=--enable-sanitizer CC=clang-3.8 CXX=clang++-3.8
- compiler: gcc
env: CC=gcc-4.9
env: CC=gcc-4.9 chain_lint=t
- compiler: clang
env: ARGS=--enable-caliper CC=clang-3.8 CXX=clang++-3.8

Expand Down Expand Up @@ -85,6 +85,8 @@ before_install:
script:
# Skip build if we already ran coverity-scan
- test "${TRAVIS_BRANCH}" != 'coverity_scan' || exit 0
# Force git to update the shallow clone and include tags so git-describe works
- git fetch --unshallow --tags
- ulimit -c unlimited
- export CC="ccache $CC"
- export MAKECMDS="make -j 2 distcheck"
Expand Down
72 changes: 40 additions & 32 deletions t/t0001-basic.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ test_expect_success 'flux-keygen works' '
rm -rf $tmpkeydir
'

# None of the individual tests should run over 10s
ARGS="-o -Sinit.rc2_timeout=10"

#
# N.B. since we have many back to back flux-starts within this test,
# and each instance runs out the shutdown grace period per issue #1006,
Expand All @@ -41,54 +44,55 @@ test_expect_success 'flux-keygen works' '
# basic functionality...
#
BUG1006="-o,--shutdown-grace=0.1"
ARGS="$ARGS $BUG1006"

test_expect_success 'broker --shutdown-grace option works' '
flux start -o,--shutdown-grace=0.1 /bin/true
'
test_expect_success 'flux-start in exec mode works' "
flux start ${BUG1006} 'flux comms info' | grep 'size=1'
flux start ${ARGS} 'flux comms info' | grep 'size=1'
"
test_expect_success 'flux-start in subprocess/pmi mode works (size 1)' "
flux start ${BUG1006} --size=1 'flux comms info' | grep 'size=1'
flux start ${ARGS} --size=1 'flux comms info' | grep 'size=1'
"
test_expect_success 'flux-start in subprocess/pmi mode works (size 2)' "
flux start ${BUG1006} --size=2 'flux comms info' | grep 'size=2'
flux start ${ARGS} --size=2 'flux comms info' | grep 'size=2'
"
test_expect_success 'flux-start with size 1 has no peers' "
flux start ${BUG1006} --size=1 'flux comms idle' > idle.out
flux start ${ARGS} --size=1 'flux comms idle' > idle.out &&
! grep 'idle' idle.out
"
test_expect_success 'flux-start with size 2 has a peer' "
flux start ${BUG1006} --size=2 'flux comms idle' > idle.out
flux start ${ARGS} --size=2 'flux comms idle' > idle.out &&
grep 'idle' idle.out
"
test_expect_success 'flux-start --size=1 --bootstrap=selfpmi works' "
flux start ${BUG1006} --size=1 --bootstrap=selfpmi /bin/true
flux start ${ARGS} --size=1 --bootstrap=selfpmi /bin/true
"
test_expect_success 'flux-start --size=1 --boostrap=pmi fails' "
test_must_fail flux start ${BUG1006} --size=1 --bootstrap=pmi /bin/true
test_must_fail flux start ${ARGS} --size=1 --bootstrap=pmi /bin/true
"
test_expect_success 'flux-start in exec mode passes through errors from command' "
test_must_fail flux start ${BUG1006} /bin/false
test_must_fail flux start ${ARGS} /bin/false
"
test_expect_success 'flux-start in subprocess/pmi mode passes through errors from command' "
test_must_fail flux start ${BUG1006} --size=1 /bin/false
test_must_fail flux start ${ARGS} --size=1 /bin/false
"
test_expect_success 'flux-start in exec mode passes exit code due to signal' "
test_expect_code 130 flux start ${BUG1006} 'kill -INT \$\$'
test_expect_code 130 flux start ${ARGS} 'kill -INT \$\$'
"
test_expect_success 'flux-start in subprocess/pmi mode passes exit code due to signal' "
test_expect_code 130 flux start ${BUG1006} --size=1 'kill -INT \$\$'
test_expect_code 130 flux start ${ARGS} --size=1 'kill -INT \$\$'
"
test_expect_success 'flux-start in exec mode works as initial program' "
flux start --size=2 flux start ${BUG1006} flux comms info | grep size=1
flux start --size=2 flux start ${ARGS} flux comms info | grep size=1
"
test_expect_success 'flux-start in subprocess/pmi mode works as initial program' "
flux start --size=2 flux start ${BUG1006} --size=1 flux comms info | grep size=1
flux start --size=2 flux start ${ARGS} --size=1 flux comms info | grep size=1
"

test_expect_success 'flux-start init.rc2_timeout attribute works' "
test_expect_code 143 flux start ${BUG1006} -o,-Sinit.rc2_timeout=0.1 sleep 5
test_expect_code 143 flux start ${ARGS} -o,-Sinit.rc2_timeout=0.1 sleep 5
"

test_expect_success 'test_under_flux works' '
Expand All @@ -109,12 +113,12 @@ test_expect_success 'test_under_flux works' '
chmod +x .test.t &&
SHARNESS_TEST_DIRECTORY=`pwd` &&
export SHARNESS_TEST_SRCDIR SHARNESS_TEST_DIRECTORY FLUX_BUILD_DIR debug &&
./.test.t --verbose --debug >out 2>err
run_timeout 5 ./.test.t --verbose --debug >out 2>err
) &&
grep "size=2" test-under-flux/out
'
test_expect_success 'flux-start -o,--setattr ATTR=VAL can set broker attributes' '
ATTR_VAL=`flux start ${BUG1006} -o,--setattr=foo-test=42 flux getattr foo-test` &&
ATTR_VAL=`flux start ${ARGS} -o,--setattr=foo-test=42 flux getattr foo-test` &&
test $ATTR_VAL -eq 42
'
test_expect_success 'tbon.endpoint can be read' '
Expand Down Expand Up @@ -158,21 +162,21 @@ test_expect_success 'mcast.relay-endpoint not set by default' '
'
test_expect_success 'broker.rundir override works' '
RUNDIR=`mktemp -d` &&
DIR=`flux start ${BUG1006} -o,--setattr=broker.rundir=$RUNDIR flux getattr broker.rundir` &&
DIR=`flux start ${ARGS} -o,--setattr=broker.rundir=$RUNDIR flux getattr broker.rundir` &&
test "$DIR" = "$RUNDIR" &&
test -d $RUNDIR &&
rmdir $RUNDIR
'
test_expect_success 'broker persist-directory works' '
PERSISTDIR=`mktemp -d` &&
flux start ${BUG1006} -o,--setattr=persist-directory=$PERSISTDIR /bin/true &&
flux start ${ARGS} -o,--setattr=persist-directory=$PERSISTDIR /bin/true &&
test -d $PERSISTDIR &&
test `ls -1 $PERSISTDIR|wc -l` -gt 0 &&
rm -rf $PERSISTDIR
'
test_expect_success 'broker persist-filesystem works' '
PERSISTFS=`mktemp -d` &&
PERSISTDIR=`flux start ${BUG1006} -o,--setattr=persist-filesystem=$PERSISTFS flux getattr persist-directory` &&
PERSISTDIR=`flux start ${ARGS} -o,--setattr=persist-filesystem=$PERSISTFS flux getattr persist-directory` &&
test -d $PERSISTDIR &&
test `ls -1 $PERSISTDIR|wc -l` -gt 0 &&
rm -rf $PERSISTDIR &&
Expand All @@ -182,7 +186,7 @@ test_expect_success 'broker persist-filesystem works' '
test_expect_success 'broker persist-filesystem is ignored if persist-directory set' '
PERSISTFS=`mktemp -d` &&
PERSISTDIR=`mktemp -d` &&
DIR=`flux start ${BUG1006} -o,--setattr=persist-filesystem=$PERSISTFS,--setattr=persist-directory=$PERSISTDIR \
DIR=`flux start ${ARGS} -o,--setattr=persist-filesystem=$PERSISTFS,--setattr=persist-directory=$PERSISTDIR \
flux getattr persist-directory` &&
test "$DIR" = "$PERSISTDIR" &&
test `ls -1 $PERSISTDIR|wc -l` -gt 0 &&
Expand All @@ -191,24 +195,24 @@ test_expect_success 'broker persist-filesystem is ignored if persist-directory s
'
# Use -eq hack to test that BROKERPID is a number
test_expect_success 'broker broker.pid attribute is readable' '
BROKERPID=`flux start ${BUG1006} flux getattr broker.pid` &&
BROKERPID=`flux start ${ARGS} flux getattr broker.pid` &&
test -n "$BROKERPID" &&
test "$BROKERPID" -eq "$BROKERPID"
'
test_expect_success 'broker broker.pid attribute is immutable' '
test_must_fail flux start ${BUG1006} -o,--setattr=broker.pid=1234 flux getattr broker.pid
test_must_fail flux start ${ARGS} -o,--setattr=broker.pid=1234 flux getattr broker.pid
'
test_expect_success 'broker --verbose option works' '
flux start ${BUG1006} -o,-v /bin/true
flux start ${ARGS} -o,-v /bin/true
'
test_expect_success 'broker --heartrate option works' '
flux start ${BUG1006} -o,--heartrate=0.1 /bin/true
flux start ${ARGS} -o,--heartrate=0.1 /bin/true
'
test_expect_success 'broker --k-ary option works' '
flux start ${BUG1006} -s4 -o,--k-ary=1 /bin/true &&
flux start ${BUG1006} -s4 -o,--k-ary=2 /bin/true &&
flux start ${BUG1006} -s4 -o,--k-ary=3 /bin/true &&
flux start ${BUG1006} -s4 -o,--k-ary=4 /bin/true
flux start ${ARGS} -s4 -o,--k-ary=1 /bin/true &&
flux start ${ARGS} -s4 -o,--k-ary=2 /bin/true &&
flux start ${ARGS} -s4 -o,--k-ary=3 /bin/true &&
flux start ${ARGS} -s4 -o,--k-ary=4 /bin/true
'

test_expect_success 'flux-help command list can be extended' '
Expand Down Expand Up @@ -254,10 +258,14 @@ test_expect_success 'flux-help command can display manpages for api calls' '
EOF
MANPATH=${PWD}/man FLUX_IGNORE_NO_DOCS=y flux help flux_foo | grep "^FOO(3)"
'
test_expect_success 'flux-help returns nonzero exit code from man(1)' '
missing_man_code()
{
man notacommand >/dev/null 2>&1
code=$?
test_expect_code $code eval FLUX_IGNORE_NO_DOCS=y flux help notacommand
echo $?
}
test_expect_success 'flux-help returns nonzero exit code from man(1)' '
test_expect_code $(missing_man_code) \
eval FLUX_IGNORE_NO_DOCS=y flux help notacommand
'
test_expect_success 'flux appends colon to missing or unset MANPATH' '
(unset MANPATH && flux /usr/bin/printenv | grep "MANPATH=.*:$") &&
Expand Down Expand Up @@ -312,7 +320,7 @@ test_expect_success 'scripts/waitfile works after 1s' '
'
# test for issue #1025
test_expect_success 'instance can stop cleanly with subscribers (#1025)' '
flux start ${BUG1006} -s2 --bootstrap=selfpmi bash -c "nohup flux event sub hb &"
flux start ${ARGS} -s2 --bootstrap=selfpmi bash -c "nohup flux event sub hb &"
'

test_done
36 changes: 18 additions & 18 deletions t/t0003-module.t
Original file line number Diff line number Diff line change
Expand Up @@ -99,52 +99,52 @@ test_expect_success 'module: insmod returns initialization error' '
'

test_expect_success 'module: list fails on invalid rank' '
flux module list -r $(invalid_rank) 2> stderr
flux module list -r $(invalid_rank) 2> stderr &&
grep "No route to host" stderr
'

test_expect_success 'module: load fails on invalid rank' '
flux module load -r $(invalid_rank) \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so 2> stderr
test_must_fail flux module load -r $(invalid_rank) \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so 2> stderr &&
grep "No route to host" stderr
'

test_expect_success 'module: remove fails on invalid rank' '
flux module load \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so
flux module remove -r $(invalid_rank) parent 2> stderr
flux module remove parent
${FLUX_BUILD_DIR}/t/module/.libs/parent.so &&
flux module remove -r $(invalid_rank) parent 2> stderr &&
flux module remove parent &&
grep "No route to host" stderr
'

test_expect_success 'module: load works on valid and invalid rank' '
flux module load -r 0,$(invalid_rank) \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so 1> stdout 2> stderr
test_must_fail flux module load -r 0,$(invalid_rank) \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so >stdout 2>stderr &&
flux module list -r 0 | grep parent &&
grep "No route to host" stderr
'

test_expect_success 'module: list works on valid and invalid rank' '
flux module list -r 0,$(invalid_rank) 1> stdout 2> stderr
flux module list -r 0,$(invalid_rank) 1> stdout 2> stderr &&
grep "parent" stdout &&
grep "No route to host" stderr
'

test_expect_success 'module: remove works on valid and invalid rank' '
flux module load -r 0,$(invalid_rank) \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so
flux module remove -r 0,$(invalid_rank) parent 2> stderr
! flux module load -r 0,$(invalid_rank) \
${FLUX_BUILD_DIR}/t/module/.libs/parent.so &&
flux module remove -r 0,$(invalid_rank) parent 2> stderr &&
! flux module list -r 0 | grep parent &&
grep "No route to host" stderr
'

test_expect_success 'module: load fails on invalid module' '
flux module load nosuchmodule 2> stderr
! flux module load nosuchmodule 2> stderr &&
grep "nosuchmodule: not found in module search path" stderr
'

test_expect_success 'module: remove fails on invalid module' '
flux module remove nosuchmodule 2> stderr
flux module remove nosuchmodule 2> stderr &&
grep "nosuchmodule: No such file or directory" stderr
'

Expand Down Expand Up @@ -207,14 +207,14 @@ test_expect_success 'flux module stats --parse "#event (tx)" counts events' '

test_expect_success 'flux module stats --clear works' '
flux event pub xyz &&
flux module stats --clear $TESTMOD
flux module stats --clear $TESTMOD &&
EVENT_TX2=$(flux module stats --parse "#event (tx)" $TESTMOD) &&
test "$EVENT_TX" = 0
'

test_expect_success 'flux module stats --clear-all works' '
flux event pub xyz &&
flux module stats --clear-all $TESTMOD
flux module stats --clear-all $TESTMOD &&
EVENT_TX2=$(flux module stats --parse "#event (tx)" $TESTMOD) &&
test "$EVENT_TX" = 0
'
Expand Down Expand Up @@ -275,9 +275,9 @@ test_expect_success 'flux module load "noexist" fails' '

test_expect_success 'flux module detects bad nodeset' '
! flux module load -r smurf kvs 2>badns-load.out &&
grep -q "target nodeset" badns-load.out
grep -q "target nodeset" badns-load.out &&
! flux module remove -r smurf kvs 2>badns-remove.out &&
grep -q "target nodeset" badns-remove.out
grep -q "target nodeset" badns-remove.out &&
! flux module list -r smurf 2>badns-list.out &&
grep -q "target nodeset" badns-list.out
'
Expand Down
Loading

0 comments on commit 820301e

Please sign in to comment.