]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add prereqs for tests using python 3.9+
authorMark Wielaard <mark@klomp.org>
Wed, 24 Apr 2024 18:50:43 +0000 (20:50 +0200)
committerMark Wielaard <mark@klomp.org>
Wed, 24 Apr 2024 19:30:48 +0000 (21:30 +0200)
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.

cachegrind/tests/ann-diff1.vgtest
cachegrind/tests/ann-diff2.vgtest
cachegrind/tests/ann-diff3.vgtest
cachegrind/tests/ann-diff4.vgtest
cachegrind/tests/ann-merge1.vgtest
cachegrind/tests/ann-merge2.vgtest
cachegrind/tests/ann1a.vgtest
cachegrind/tests/ann1b.vgtest
cachegrind/tests/ann2.vgtest
tests/Makefile.am
tests/python_test.sh [new file with mode: 0755]

index ab119b3b3643b1db68707d53490a293126bbfaa5..cec140c4e9f7a10e307f569b87cb50bb4ef301e4 100644 (file)
@@ -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
index bae3ab98753f24bdc5c18890c2bd3c2391fe80ef..24d4ebb4a15214961eff138f08e46a26823c21bd 100644 (file)
@@ -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
index 5831e3de61d3a55530890eeaf91c7583e743a4d0..5696ae83ee6ca508df7fb8048224a01101d6f582 100644 (file)
@@ -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 
index da6e00a2164b398b1789169528878ddb3a46e560..6b08895209cc635f3116d3e2a3ae1fcf12c19ce8 100644 (file)
@@ -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
index 2779de1d128a3e0a38e692f83f8a9869251702b6..6510f5fc758da07f638763eb7fc86fd2cd63ab15 100644 (file)
@@ -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
index e8223247eb17407967f4d6646eaec382deba3b40..c93f25f263fb80e7541d8cc28e2da529bc57997c 100644 (file)
@@ -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
 
index 16da66699e77ccb6af41ab5e8cb9083685e1608f..50ea42ea69e8638219dc922b4c9b2b4615472f6f 100644 (file)
@@ -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
index 0aa3a1e212f0ceee6eaa8730e0cc494238a07dc0..6d863c6247d04f0b86718e5502b5d180ec4392ba 100644 (file)
@@ -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
index 5598bdc4bd895056d2542de74e38f68911e32e04..47f17d62ba566c4e71f4795ec6c6fa44597f57da 100644 (file)
@@ -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
index 86c81b315bbb411d770b18a4e000d816c0ea2c0f..efe3546ac7f3091398a05030b1656dbe114fafc3 100644 (file)
@@ -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 (executable)
index 0000000..87f435b
--- /dev/null
@@ -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