3 . "${TEST_SCRIPTS_DIR}/unit.sh"
6 required_result 1 <<EOF
7 run_event_init() failed, ret=2
9 unit_test run_event_test /a/b/c list
11 scriptdir=$(TMPDIR="$TEST_VAR_DIR" mktemp -d)
15 No event scripts found
17 unit_test run_event_test "$scriptdir" list
19 cat > "$scriptdir/prog" <<EOF
25 # Invalid script, doesn't end in ".script"
27 No event scripts found
29 unit_test run_event_test "$scriptdir" list
31 # Is not found because enabling "prog" actually looks for "prog.script"
33 Script enable prog completed with result=2
35 unit_test run_event_test "$scriptdir" enable prog
37 required_result 1 <<EOF
39 unit_test test -x "${scriptdir}/prog"
41 cat > "$scriptdir/11.foo.script" <<EOF
51 unit_test run_event_test "$scriptdir" list
54 Script enable 11.foo completed with result=0
56 unit_test run_event_test "$scriptdir" enable 11.foo
60 unit_test test -x "${scriptdir}/11.foo.script"
64 Event monitor completed with result=0
67 unit_test run_event_test "$scriptdir" run 10 monitor
69 cat > "$scriptdir/22.bar.script" <<EOF
80 unit_test run_event_test "$scriptdir" list
83 Script enable 22.bar completed with result=0
85 unit_test run_event_test "$scriptdir" enable 22.bar
89 Event monitor completed with result=1
93 unit_test run_event_test "$scriptdir" run 10 monitor
97 Script disable 22.bar completed with result=0
99 unit_test run_event_test "$scriptdir" disable 22.bar
101 required_result 1 <<EOF
103 unit_test test -x "${scriptdir}/22.bar.script"
107 Event monitor completed with result=0
109 22.bar result=-$(errcode ENOEXEC)
111 unit_test run_event_test "$scriptdir" run 10 monitor
113 cat > "$scriptdir/22.bar.script" <<EOF
121 Script enable 22.bar completed with result=0
123 unit_test run_event_test "$scriptdir" enable 22.bar
127 Event monitor completed with result=-$(errcode ETIMEDOUT)
129 22.bar result=-$(errcode ETIMEDOUT)
131 unit_test run_event_test "$scriptdir" run 5 monitor