diff --git a/tests/syntax/cpp-command.t/filter.py b/tests/syntax/cpp-command.t/filter.py index e4b379acf6557507cea8237e72d1bd02649013fe..c6056c0d744e43c8694eac25cfd7be50640790db 100644 --- a/tests/syntax/cpp-command.t/filter.py +++ b/tests/syntax/cpp-command.t/filter.py @@ -5,17 +5,12 @@ import re import sys -FRAMAC_SHARE = sys.argv[1] - for line in sys.stdin: # Apply several filters: # - Remove preprocessed filename (randomly generated) line = re.sub(r"/[^ ]*cpp-command.c......\.i", "<TMPDIR/PP>.i", line) # - Remove hardcoded path to temporary __fc_machdepXXXXXX.dir 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 line = re.sub("-m32", "", line) line = re.sub("-m64", "", line) diff --git a/tests/syntax/cpp-command.t/run.t b/tests/syntax/cpp-command.t/run.t index df18a503c060f2c8b3bfeb3486e93640fef85595..0acf9e13b4d9f599d025623e75916f0a8ba8efbf 100644 --- a/tests/syntax/cpp-command.t/run.t +++ b/tests/syntax/cpp-command.t/run.t @@ -1,26 +1,27 @@ - $ 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) - [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) - %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\")\"" [kernel] Parsing cpp-command.c (with preprocessing) 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) %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: - 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) /* Generated by Frama-C */ #include "errno.h" @@ -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 `-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) - 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. /* Generated by Frama-C */