File: bugged1_liveness_stack_cleaner

package info (click to toggle)
simgrid 3.21%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 21,972 kB
  • sloc: cpp: 88,193; ansic: 69,244; fortran: 6,089; f90: 5,162; xml: 4,861; java: 4,250; perl: 2,056; python: 1,193; sh: 1,159; makefile: 57; sed: 6
file content (59 lines) | stat: -rwxr-xr-x 1,225 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env sh
# Run the same test compiled with -fstack-cleaner / f-no-stack-cleaner
# and compare the output.

srcdir="$1"
bindir="$2"

cd "$srcdir"

die() {
  echo "$@" >&2
  exit 1
}

assert() {
  if ! eval "$1"; then
    die "Assertion failed: $@"
  fi
}

# If we don't have timeout, fake it:
if ! which timeout > /dev/null; then
  timeout() {
    shift
    "$@"
  }
fi

run() {
  state=$1
  shift
  timeout 30s ${bindir:=.}/bugged1_liveness_cleaner_$state \
    ${srcdir:=.}/../../platforms/platform.xml \
    ${srcdir:=.}/deploy_bugged1_liveness.xml \
    "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n" \
    --cfg=contexts/factory:ucontext \
    --cfg=contexts/stack-size:256
  assert 'test $? = 134'
}

get_states() {
  echo "$1" | grep "Expanded pairs = " | sed "s/^.*Expanded pairs = //" | head -n1
}

RES_ON="$(run on 2>&1 1>/dev/null)"
RES_OFF="$(run off 2>&1 1>/dev/null)"

STATES_ON=$(get_states "$RES_ON")
STATES_OFF=$(get_states "$RES_OFF")

# Both runs finished:
assert 'test -n "$STATES_ON"'
assert 'test -n "$STATES_OFF"'

# We expect 21 visited pairs with the stack cleaner:
assert 'test "$STATES_ON" = 21'

# We expect more states without the stack cleaner:
assert 'test "$STATES_ON" -lt "$STATES_OFF"'