[Bf-blender-cvs] [464e545c723] master: Tests: move "make test" on macOS and Linux to Python script

Brecht Van Lommel noreply at git.blender.org
Fri Aug 30 18:04:15 CEST 2019


Commit: 464e545c723616372bfeec8e955bf1177437fa32
Author: Brecht Van Lommel
Date:   Fri Aug 30 14:20:29 2019 +0200
Branches: master
https://developer.blender.org/rB464e545c723616372bfeec8e955bf1177437fa32

Tests: move "make test" on macOS and Linux to Python script

===================================================================

M	GNUmakefile
A	build_files/utils/make_test.py
M	build_files/utils/make_update.py
A	build_files/utils/make_utils.py

===================================================================

diff --git a/GNUmakefile b/GNUmakefile
index 92d1efca21d..ef1b6b711d2 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -375,7 +375,7 @@ package_archive: .FORCE
 # Tests
 #
 test: .FORCE
-	cd $(BUILD_DIR) ; ctest . --output-on-failure
+	python3 ./build_files/utils/make_test.py "$(BUILD_DIR)"
 
 # run pep8 check check on scripts we distribute.
 test_pep8: .FORCE
diff --git a/build_files/utils/make_test.py b/build_files/utils/make_test.py
new file mode 100755
index 00000000000..1522631de4b
--- /dev/null
+++ b/build_files/utils/make_test.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+# "make test" for all platforms, running automated tests.
+
+import argparse
+import os
+import shutil
+import sys
+
+from make_utils import call
+
+# Parse arguments
+
+def parse_arguments():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--ctest-command", default="ctest")
+    parser.add_argument("build_directory")
+    return parser.parse_args()
+
+args = parse_arguments()
+ctest_command = args.ctest_command
+build_dir = args.build_directory
+
+if shutil.which(ctest_command) is None:
+    sys.stderr.write("ctest not found, can't run tests\n")
+    sys.exit(1)
+
+# Run tests
+os.chdir(build_dir)
+call([ctest_command, ".", "--output-on-failure"])
diff --git a/build_files/utils/make_update.py b/build_files/utils/make_update.py
index 5d82075d562..a019e17e0a8 100755
--- a/build_files/utils/make_update.py
+++ b/build_files/utils/make_update.py
@@ -13,6 +13,8 @@ import shutil
 import subprocess
 import sys
 
+from make_utils import call
+
 # Parse arguments
 
 def parse_arguments():
@@ -35,19 +37,6 @@ if shutil.which(svn_command) is None:
     sys.stderr.write("svn not found, can't update libraries\n")
     sys.exit(1)
 
-# Utility functions
-
-def call(cmd):
-    print(" ".join(cmd))
-
-    # Flush to ensure correct order output on Windows.
-    sys.stdout.flush()
-    sys.stderr.flush()
-
-    retcode = subprocess.call(cmd)
-    if retcode != 0:
-      sys.exit(retcode)
-
 def print_stage(text):
     print("")
     print(text)
diff --git a/build_files/utils/make_utils.py b/build_files/utils/make_utils.py
new file mode 100755
index 00000000000..98536879b91
--- /dev/null
+++ b/build_files/utils/make_utils.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+#
+# Utility functions for make update and make tests.
+
+import subprocess
+import sys
+
+def call(cmd):
+    print(" ".join(cmd))
+
+    # Flush to ensure correct order output on Windows.
+    sys.stdout.flush()
+    sys.stderr.flush()
+
+    retcode = subprocess.call(cmd)
+    if retcode != 0:
+      sys.exit(retcode)



More information about the Bf-blender-cvs mailing list