@@ -16,43 +16,36 @@ function compile_file() {
1616 erlc -o " $output_dir " " $erl_file "
1717}
1818
19- function contains() {
20- local pipeline=' cat -'
19+ function contains_all() {
20+ local output=" $( cat -) "
21+ local ret= acc=0
2122 for pattern in " $@ " ; do
22- pipeline+=" | tee >(grep -q -e \" $pattern \" ; echo \" +\$ ?\" )"
23+ ret=" $( echo " $output " | grep -L -e " $pattern " | wc -l) "
24+ if [ " $ret " -ne " 0" ]; then
25+ [ " $(( $acc )) " -eq " 0" ] && {
26+ echo " contains_all FAILED"
27+ echo " stdin: '${output} '" ; }
28+ echo " pattern is missing: '${pattern} '"
29+ fi >&2
30+ acc+=" +${ret} "
2331 done
24- pipeline+=' >/dev/null'
25- local output=" $( eval " $pipeline " ) "
26- test " $(( $output )) " -eq 0
32+ test " $(( $acc )) " -eq 0
2733}
2834
29- function doesnt_contain() {
30- local pipeline=' cat -'
35+ function doesnt_contain_any() {
36+ local output=" $( cat -) "
37+ local ret= acc=0
3138 for pattern in " $@ " ; do
32- pipeline+=" | tee >(grep -q -v -e \" $pattern \" ; echo \" +\$ ?\" )"
39+ ret=" $( echo " $output " | grep -l -e " $pattern " | wc -l || true) "
40+ if [ " $ret " -ne " 0" ]; then
41+ [ " $(( $acc )) " -eq " 0" ] && {
42+ echo " doesnt_contain_any FAILED"
43+ echo " stdin: '${output} '" ; }
44+ echo " pattern is present: '${pattern} '"
45+ fi >&2
46+ acc+=" +${ret} "
3347 done
34- pipeline+=' >/dev/null'
35- local output=" $( eval " $pipeline " ) "
36- test " $(( $output )) " -eq 0
37- }
38-
39- function wait_for_cmd() {
40- local timeout=" ${1:- 0} "
41- local cmd=" ${2:- true} "
42- shift 2
43- local full_cmd=(" $cmd " " $@ " )
44- echo " Waiting for '${full_cmd[@]} '"
45- for i in $( seq 0 " ${timeout} " ) ; do
46- if " ${full_cmd[@]} " ; then
47- [ " $i " -ne 0 ] && echo
48- echo " Waiting is done after $i seconds"
49- return 0
50- fi
51- echo -n " ."
52- sleep 1
53- done
54- echo -e " \nKilled by timeout"
55- return 1
48+ test " $(( $acc )) " -eq 0
5649}
5750
5851# #####################
@@ -70,15 +63,6 @@ function amoc_eval() {
7063 docker_compose exec -T " $service " " $exec_path " eval " $@ "
7164}
7265
73- function container_is_healthy() {
74- docker_compose ps $1 | contains " healthy"
75- }
76-
77- function wait_for_healthcheck() {
78- local container=$1
79- wait_for_cmd 60 container_is_healthy " $container "
80- }
81-
8266# #####################
8367# # common variables ##
8468# #####################
0 commit comments