summaryrefslogtreecommitdiff
path: root/testsuite/tests/instrumented-runtime/main.run
blob: 430dd23188b36e121f89a0d02ca59e42a7da124e (plain)
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
#!/bin/sh

export OCAML_EVENTLOG_ENABLED=1
export OCAML_EVENTLOG_PREFIX=${program}

if [ "${os_type}" = "Win32" ] ; then
  program=$(cygpath "$program")
fi

rm -f "${program}"*.eventlog*
${program} > ${output} &

pid=$!
wait $pid

ls "${program}".*.eventlog | grep '\.[0-9][0-9]*\.eventlog$' | \
while IFS= read -r file; do
  touch ${program}.eventlogs
  if [ ! -e "${program}.eventlog" ] ; then
    touch ${program}.eventlog
  else
    rm -f ${program}.eventlog
    break
  fi
done

if [ -f "${program}.eventlog" ]; then
  exit ${TEST_PASS}
elif [ -f "${program}.eventlogs" ]; then
  echo 'too many runtime traces found!' > ${ocamltest_response}
  exit ${TEST_FAIL}
else
  echo 'instrumented runtime trace not found!' > ${ocamltest_response}
  exit ${TEST_FAIL}
fi