Home | History | Annotate | Download | only in tests
      1 #!/bin/sh
      2 
      3 # Check -S option.
      4 
      5 . "${srcdir=.}/init.sh"
      6 
      7 run_prog ../readv > /dev/null
      8 
      9 test_c()
     10 {
     11 	local sortby sortopts sedexpr
     12 	sortby="$1"; shift
     13 	sortopts="$1"; shift
     14 	sedexpr="$1"; shift
     15 
     16 	run_strace -c -w -S "$sortby" ../readv > /dev/null
     17 	sed -r -n -e "$sedexpr" < "$LOG" > "$OUT"
     18 
     19 	[ -s "$OUT" ] ||
     20 		fail_ "$STRACE $args output mismatch"
     21 	LC_ALL=C sort -c $sortopts "$OUT" || {
     22 		echo 'Actual output:'
     23 		cat < "$LOG"
     24 		fail_ "$STRACE $args output not sorted properly"
     25 	}
     26 }
     27 
     28 c='[[:space:]]+([^[:space:]]+)'
     29 test_c calls '-n -r' '/^[[:space:]]+[0-9]/ s/^'"$c$c$c$c"'[[:space:]].*/\4/p'
     30 test_c name '' '/^[[:space:]]+[0-9]/ s/^'"$c$c$c$c"'([[:space:]]+[0-9]+)?'"$c"'$/\6/p'
     31