From 04a95030eb3a1beb416837cfc17c1a9684cc5bc2 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Wed, 11 Sep 2024 12:24:37 +0100 Subject: [PATCH] Add a Valgrind builder + factory with a selected set of tests Signed-off-by: Pablo Galindo --- master/custom/builders.py | 4 +++ master/custom/factories.py | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/master/custom/builders.py b/master/custom/builders.py index 16fdc9d50..637092bbd 100644 --- a/master/custom/builders.py +++ b/master/custom/builders.py @@ -47,6 +47,7 @@ Wasm32WasiDebugBuild, IOSARM64SimulatorBuild, AndroidBuild, + ValgrindBuild, ) # A builder can be marked as stable when at least the 10 latest builds are @@ -219,6 +220,8 @@ ("AMD64 CentOS9 LTO + PGO", "cstratak-CentOS9-x86_64", LTOPGONonDebugBuild), ("AMD64 CentOS9 FIPS Only Blake2 Builtin Hash", "cstratak-CentOS9-fips-x86_64", CentOS9NoBuiltinHashesUnixBuildExceptBlake2), ("AMD64 CentOS9 FIPS No Builtin Hashes", "cstratak-CentOS9-fips-x86_64", CentOS9NoBuiltinHashesUnixBuild), + + ("AMD64 Arch Linux Valgrind", "pablogsal-arch-x86_64", ValgrindBuild), ] @@ -347,4 +350,5 @@ def get_builders(settings): "Cygwin", "ARM64 Windows", "AMD64 Arch Linux Perf", + "AMD64 Arch Linux Valgrind", ) diff --git a/master/custom/factories.py b/master/custom/factories.py index 343df5ac9..beb15d347 100644 --- a/master/custom/factories.py +++ b/master/custom/factories.py @@ -1219,3 +1219,68 @@ def setup(self, **kwargs): def host_triple(props): build_triple = props.getProperty("build_triple") return build_triple.split("-")[0] + "-linux-android" + + +class ValgrindBuild(UnixBuild): + buildersuffix = ".valgrind" + configureFlags = [ + "--with-pydebug", + "--with-valgrind", + "--without-pymalloc", + ] + testFlags = [ + "test_grammar", + "test_syntax", + "test_tokenize", + "test_fstring", + "test_ast", + "test_exceptions", + ] + factory_tags = ["valgrind"] + test_timeout = TEST_TIMEOUT * 5 + + def setup(self, parallel, branch, **kwargs): + self.addStep( + Configure( + command=["./configure", "--prefix", "$(PWD)/target"] + self.configureFlags + ) + ) + + compile = ["make", self.makeTarget] + if parallel: + compile = ["make", parallel, self.makeTarget] + + self.addStep(Compile(command=compile, env=self.compile_environ)) + + self.addStep( + ShellCommand( + name="pythoninfo", + description="pythoninfo", + command=["make", "pythoninfo"], + warnOnFailure=True, + env=self.test_environ, + ) + ) + + test = [ + "valgrind", + "--leak-check=full", + "--show-leak-kinds=definite", + "--error-exitcode=10", + "--gen-suppressions=all", + "--track-origins=yes", + "--trace-children=yes", + "--suppressions=$(PWD)/Misc/valgrind-python.supp", + "./python", + "-m", "test", + *self.testFlags, + f"--timeout={self.test_timeout}", + ] + + self.addStep(Test( + command=test, + timeout=step_timeout(self.test_timeout), + env=self.test_environ, + )) + + self.addStep(Clean()) \ No newline at end of file