From: Mark Wielaard Date: Wed, 24 Apr 2024 18:50:43 +0000 (+0200) Subject: Add prereqs for tests using python 3.9+ X-Git-Tag: VALGRIND_3_23_0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26ebac7b4ce1a7b516604e7332c903dda28f9258;p=thirdparty%2Fvalgrind.git Add prereqs for tests using python 3.9+ Adds a script tests/python_test.sh that checks whether there is a python3 binary and that it supports python version 3.9 or higher. Use this script in the various cachegrind/tests annotate vgtests as prereq. --- diff --git a/cachegrind/tests/ann-diff1.vgtest b/cachegrind/tests/ann-diff1.vgtest index ab119b3b36..cec140c4e9 100644 --- a/cachegrind/tests/ann-diff1.vgtest +++ b/cachegrind/tests/ann-diff1.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout files. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out post: python3 ../cg_diff --mod-funcname="s/main/MAIN/" ann1.cgout ann1b.cgout > ann-diff1.cgout && python3 ../cg_annotate --mod-filename="s/a.c/A.c/" --mod-funcname s/MAIN/Main/ ann-diff1.cgout diff --git a/cachegrind/tests/ann-diff2.vgtest b/cachegrind/tests/ann-diff2.vgtest index bae3ab9875..24d4ebb4a1 100644 --- a/cachegrind/tests/ann-diff2.vgtest +++ b/cachegrind/tests/ann-diff2.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout files. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out post: python3 ../cg_diff --mod-filename="s/.*aux\//aux\//i" --mod-funcname="s/(f[a-z]*)[0-9]/\1N/g" ann-diff2a.cgout ann-diff2b.cgout > ann-diff2c.cgout && python3 ../cg_annotate ann-diff2c.cgout diff --git a/cachegrind/tests/ann-diff3.vgtest b/cachegrind/tests/ann-diff3.vgtest index 5831e3de61..5696ae83ee 100644 --- a/cachegrind/tests/ann-diff3.vgtest +++ b/cachegrind/tests/ann-diff3.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout files. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out post: python3 ../cg_annotate --diff --mod-filename="s/.*aux\//aux\//i" --mod-funcname="s/(f[a-z]*)[0-9]/\1N/g" ann-diff2a.cgout ann-diff2b.cgout diff --git a/cachegrind/tests/ann-diff4.vgtest b/cachegrind/tests/ann-diff4.vgtest index da6e00a216..6b08895209 100644 --- a/cachegrind/tests/ann-diff4.vgtest +++ b/cachegrind/tests/ann-diff4.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout files. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out # The `sleep` is to ensure the mtime of the second touched file is greater than diff --git a/cachegrind/tests/ann-merge1.vgtest b/cachegrind/tests/ann-merge1.vgtest index 2779de1d12..6510f5fc75 100644 --- a/cachegrind/tests/ann-merge1.vgtest +++ b/cachegrind/tests/ann-merge1.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout files. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out post: python3 ../cg_merge ann-merge1a.cgout ann-merge1b.cgout > ann-merge1c.cgout && python3 ../cg_annotate ann-merge1c.cgout diff --git a/cachegrind/tests/ann-merge2.vgtest b/cachegrind/tests/ann-merge2.vgtest index e8223247eb..c93f25f263 100644 --- a/cachegrind/tests/ann-merge2.vgtest +++ b/cachegrind/tests/ann-merge2.vgtest @@ -2,7 +2,7 @@ # the post-processing of the cgout files. # The touch is because git clone might give the cgout files a timestamp # in the future wrt the source file which generates a warning and post failure -prereq: touch ann-merge1a.cgout ann-merge1b.cgout +prereq: touch ann-merge1a.cgout ann-merge1b.cgout && ../../tests/python_test.sh prog: ../../tests/true vgopts: --cachegrind-out-file=cachegrind.out diff --git a/cachegrind/tests/ann1a.vgtest b/cachegrind/tests/ann1a.vgtest index 16da66699e..50ea42ea69 100644 --- a/cachegrind/tests/ann1a.vgtest +++ b/cachegrind/tests/ann1a.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout file. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out post: touch ann1.cgout && python3 ../cg_annotate --show=Ir,I1mr,ILmr --show-percs=no ann1.cgout diff --git a/cachegrind/tests/ann1b.vgtest b/cachegrind/tests/ann1b.vgtest index 0aa3a1e212..6d863c6247 100644 --- a/cachegrind/tests/ann1b.vgtest +++ b/cachegrind/tests/ann1b.vgtest @@ -1,6 +1,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout file. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out post: touch ann1.cgout && python3 ../cg_annotate --sort=Dr --show=Dw,Dr,Ir --auto=no ann1.cgout diff --git a/cachegrind/tests/ann2.vgtest b/cachegrind/tests/ann2.vgtest index 5598bdc4bd..47f17d62ba 100644 --- a/cachegrind/tests/ann2.vgtest +++ b/cachegrind/tests/ann2.vgtest @@ -4,6 +4,7 @@ # The `prog` doesn't matter because we don't use its output. Instead we test # the post-processing of the cgout file. prog: ../../tests/true +prereq: ../../tests/python_test.sh vgopts: --cachegrind-out-file=cachegrind.out # The `sleep` is to ensure the mtime of the second touched file is greater than diff --git a/tests/Makefile.am b/tests/Makefile.am index 86c81b315b..efe3546ac7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,6 +33,7 @@ dist_noinst_SCRIPTS = \ filter_xml_frames \ platform_test \ post_regtest_checks \ + python_test.sh \ vg_regtest noinst_SCRIPTS = \ diff --git a/tests/python_test.sh b/tests/python_test.sh new file mode 100755 index 0000000000..87f435b74f --- /dev/null +++ b/tests/python_test.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# We need a python3 binary +type python3 2>/dev/null 1>/dev/null || exit 1 + +# And it needs to support at least version 3.9 +python3 -c 'import sys; assert sys.version_info >= (3,9)' 2>/dev/null || exit 1 + +exit 0