Skip to content
Snippets Groups Projects
Commit aa0f5e7e authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[tests] use dune filter for FRAMAC_SHARE in cram tests

parent 0fa37d8e
No related branches found
No related tags found
No related merge requests found
...@@ -5,17 +5,12 @@ ...@@ -5,17 +5,12 @@
import re import re
import sys import sys
FRAMAC_SHARE = sys.argv[1]
for line in sys.stdin: for line in sys.stdin:
# Apply several filters: # Apply several filters:
# - Remove preprocessed filename (randomly generated) # - Remove preprocessed filename (randomly generated)
line = re.sub(r"/[^ ]*cpp-command.c......\.i", "<TMPDIR/PP>.i", line) line = re.sub(r"/[^ ]*cpp-command.c......\.i", "<TMPDIR/PP>.i", line)
# - Remove hardcoded path to temporary __fc_machdepXXXXXX.dir # - Remove hardcoded path to temporary __fc_machdepXXXXXX.dir
line = re.sub(r"-I.*__fc_machdep......\.dir", "-I<TMP_MACHDEP>", line) line = re.sub(r"-I.*__fc_machdep......\.dir", "-I<TMP_MACHDEP>", line)
# - Replace occurrence of FRAMAC_SHARE; re.escape is needed if the path
# contains e.g. a '+' character
line = re.sub(re.escape(f"-I{FRAMAC_SHARE}"), "-I<FRAMAC_SHARE>", line)
# Remove spurious '-m32' and '-m64', which are architecture-dependent # Remove spurious '-m32' and '-m64', which are architecture-dependent
line = re.sub("-m32", "", line) line = re.sub("-m32", "", line)
line = re.sub("-m64", "", line) line = re.sub("-m64", "", line)
......
$ FRAMAC_SHARE="$(frama-c-config -print-share-path)" $ export FRAMAC_SHARE="$(frama-c-config -print-share-path)"
$ export BUILD_PATH_PREFIX_MAP="\$FRAMAC_SHARE=${FRAMAC_SHARE}:$BUILD_PATH_PREFIX_MAP"
$ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "echo [\$(basename '%1') \$(basename '%1') \$(basename '%i') \$(basename '%input')] ['%2' '%2' '%o' '%output'] ['%args']" | python3 filter.py "$FRAMAC_SHARE" $ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "echo [\$(basename '%1') \$(basename '%1') \$(basename '%i') \$(basename '%input')] ['%2' '%2' '%o' '%output'] ['%args']" | python3 filter.py
[kernel] Parsing cpp-command.c (with preprocessing) [kernel] Parsing cpp-command.c (with preprocessing)
[cpp-command.c cpp-command.c cpp-command.c cpp-command.c] [<TMPDIR/PP>.i <TMPDIR/PP>.i <TMPDIR/PP>.i <TMPDIR/PP>.i] [-I<TMP_MACHDEP> -I<FRAMAC_SHARE>/libc -D__FRAMAC__ -dD -nostdinc] [cpp-command.c cpp-command.c cpp-command.c cpp-command.c] [<TMPDIR/PP>.i <TMPDIR/PP>.i <TMPDIR/PP>.i <TMPDIR/PP>.i] [-I<TMP_MACHDEP> -I$FRAMAC_SHARE/libc -D__FRAMAC__ -dD -nostdinc]
$ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "echo %%1 = \$(basename '%1') %%2 = '%2' %%args = '%args'" | python3 filter.py "$FRAMAC_SHARE" $ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "echo %%1 = \$(basename '%1') %%2 = '%2' %%args = '%args'" | python3 filter.py
[kernel] Parsing cpp-command.c (with preprocessing) [kernel] Parsing cpp-command.c (with preprocessing)
%1 = cpp-command.c %2 = <TMPDIR/PP>.i %args = -I<TMP_MACHDEP> -I<FRAMAC_SHARE>/libc -D__FRAMAC__ -dD -nostdinc %1 = cpp-command.c %2 = <TMPDIR/PP>.i %args = -I<TMP_MACHDEP> -I$FRAMAC_SHARE/libc -D__FRAMAC__ -dD -nostdinc
$ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "printf \"%s\n\" \"using \\% has no effect : \$(basename \"\%input\")\"" $ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "printf \"%s\n\" \"using \\% has no effect : \$(basename \"\%input\")\""
[kernel] Parsing cpp-command.c (with preprocessing) [kernel] Parsing cpp-command.c (with preprocessing)
using \% has no effect : cpp-command.c' using \% has no effect : cpp-command.c'
$ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "echo %var is not an interpreted placeholder" | python3 filter.py "$FRAMAC_SHARE" $ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -cpp-frama-c-compliant -cpp-command "echo %var is not an interpreted placeholder" | python3 filter.py
[kernel] Parsing cpp-command.c (with preprocessing) [kernel] Parsing cpp-command.c (with preprocessing)
%var is not an interpreted placeholder %var is not an interpreted placeholder
$ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -print-cpp-commands | python3 filter.py "$FRAMAC_SHARE" $ frama-c -check -no-autoload-plugins cpp-command.c -machdep x86_32 -print-cpp-commands | python3 filter.py
[kernel] Preprocessing command: [kernel] Preprocessing command:
gcc -E -C -I<TMP_MACHDEP> -I<FRAMAC_SHARE>/libc -D__FRAMAC__ -dD -nostdinc -Wno-builtin-macro-redefined -Wno-unknown-warning-option '$TESTCASE_ROOT/cpp-command.c' -o '<TMPDIR/PP>.i' gcc -E -C -I<TMP_MACHDEP> -I$FRAMAC_SHARE/libc -D__FRAMAC__ -dD -nostdinc -Wno-builtin-macro-redefined -Wno-unknown-warning-option '$TESTCASE_ROOT/cpp-command.c' -o '<TMPDIR/PP>.i'
$ frama-c -check -no-autoload-plugins cpp-command.c -cpp-extra-args-per-file=cpp-command.c:"-DPF=\\\"cp%02d_%.3f\\\"" -cpp-extra-args="-DPF2=\\\"cp%02d_%.3f\\\"" -print | python3 filter.py "$FRAMAC_SHARE" $ frama-c -check -no-autoload-plugins cpp-command.c -cpp-extra-args-per-file=cpp-command.c:"-DPF=\\\"cp%02d_%.3f\\\"" -cpp-extra-args="-DPF2=\\\"cp%02d_%.3f\\\"" -print | python3 filter.py
[kernel] Parsing cpp-command.c (with preprocessing) [kernel] Parsing cpp-command.c (with preprocessing)
/* Generated by Frama-C */ /* Generated by Frama-C */
#include "errno.h" #include "errno.h"
...@@ -43,11 +44,11 @@ ...@@ -43,11 +44,11 @@
$ frama-c -check -no-autoload-plugins cpp-command.c -cpp-extra-args-per-file=cpp-command.c:"file_extra" -cpp-extra-args="global_extra" -cpp-command "echo 'extra_args: %args'" -print | python3 filter.py "$FRAMAC_SHARE" $ frama-c -check -no-autoload-plugins cpp-command.c -cpp-extra-args-per-file=cpp-command.c:"file_extra" -cpp-extra-args="global_extra" -cpp-command "echo 'extra_args: %args'" -print | python3 filter.py
[kernel] Warning: your preprocessor is not known to handle option `-nostdinc'. If preprocessing fails because of it, please add -no-cpp-frama-c-compliant option to Frama-C's command-line. If you do not want to see this warning again, explicitly use option -cpp-frama-c-compliant. [kernel] Warning: your preprocessor is not known to handle option `-nostdinc'. If preprocessing fails because of it, please add -no-cpp-frama-c-compliant option to Frama-C's command-line. If you do not want to see this warning again, explicitly use option -cpp-frama-c-compliant.
[kernel] Warning: your preprocessor is not known to handle option `-dD'. If preprocessing fails because of it, please add -no-cpp-frama-c-compliant option to Frama-C's command-line. If you do not want to see this warning again, explicitly use option -cpp-frama-c-compliant. [kernel] Warning: your preprocessor is not known to handle option `-dD'. If preprocessing fails because of it, please add -no-cpp-frama-c-compliant option to Frama-C's command-line. If you do not want to see this warning again, explicitly use option -cpp-frama-c-compliant.
[kernel] Parsing cpp-command.c (with preprocessing) [kernel] Parsing cpp-command.c (with preprocessing)
extra_args: -I<TMP_MACHDEP> -I<FRAMAC_SHARE>/libc -D__FRAMAC__ -dD -nostdinc file_extra global_extra extra_args: -I<TMP_MACHDEP> -I$FRAMAC_SHARE/libc -D__FRAMAC__ -dD -nostdinc file_extra global_extra
[kernel] Warning: trying to preprocess annotation with an unknown preprocessor. [kernel] Warning: trying to preprocess annotation with an unknown preprocessor.
/* Generated by Frama-C */ /* Generated by Frama-C */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment