| 1 |
#!/bin/bash -e |
| 2 |
|
| 3 |
# Script to reduce a Frama-C non-crashing test case. |
| 4 |
|
| 5 |
# This script must be completed by the user. |
| 6 |
# Names between '@'s will be replaced by creduce.sh. |
| 7 |
# See the Frama-C User Manual for more details. |
| 8 |
|
| 9 |
cc_out=$(mktemp creduce_cc_XXXXXX.log) |
| 10 |
fc_out=$(mktemp creduce_fc_XXXXXX.log) |
| 11 |
|
| 12 |
# We always check that the reduced file remains valid C code. |
| 13 |
set -o pipefail |
| 14 |
@CPP@ "@BASE@" 2>&1 | tee $cc_out |
| 15 |
set +o pipefail |
| 16 |
|
| 17 |
### Examples of conditions to be maintained by C-Reduce; copy and adapt |
| 18 |
# |
| 19 |
# Ensure that the C file contains <expr> |
| 20 |
# grep -q expr "@BASE@" |
| 21 |
# |
| 22 |
# Ensure that the compiler output contains <expr> |
| 23 |
# grep -q <expr> "$cc_out" |
| 24 |
# |
| 25 |
### |
| 26 |
|
| 27 |
########## INSERT CONDITION(S) RELATED TO THE SOURCE HERE ########## |
| 28 |
|
| 29 |
########## |
| 30 |
|
| 31 |
set -o pipefail |
| 32 |
"@FRAMAC@" "@BASE@" @FCFLAGS@ 2>&1 | tee $fc_out |
| 33 |
fc_retcode=$(echo ${PIPESTATUS[0]}) |
| 34 |
set +o pipefail |
| 35 |
|
| 36 |
### Examples of conditions to be maintained by C-Reduce; copy and adapt |
| 37 |
# |
| 38 |
# Ensure that Frama-C emits <expr> |
| 39 |
# grep -q <expr> "$fc_out" |
| 40 |
# |
| 41 |
# Ensure that the exit code of Frama_C is <rc> |
| 42 |
# test $fc_retcode -eq <rc> |
| 43 |
# |
| 44 |
### |
| 45 |
|
| 46 |
########## INSERT CONDITION(S) RELATED TO FRAMA-C HERE ########## |
| 47 |
|
| 48 |
########## |
| 49 |
|
| 50 |
### Cleanup |
| 51 |
rm -f $cc_out $fc_out |