freebsd-ports/devel/ice/files/patch-scripts-TestUtil.py
Michael Gmelin de8b4e1915 Make sure that failed unit tests lead to failed builds.
Fix the unit test python script provided upstream [1] and
move running the unit test to the pre-install target.

[1] https://zeroc.com/forums/patches/6416-ice-3-5-1-small-patch-testutil-py.html

Approved by:	mentors (implicit)
2015-03-23 15:28:05 +00:00

52 lines
1.9 KiB
Python

--- scripts.orig/TestUtil.py 2013-03-11 15:19:47.000000000 +0000
+++ scripts/TestUtil.py 2015-03-23 14:08:57.225102620 +0000
@@ -84,6 +84,25 @@
def isLinux():
return sys.platform.startswith("linux")
+def isFreeBSD():
+ return sys.platform.startswith("freebsd")
+
+def sysctl(key):
+ p = subprocess.Popen("sysctl "+key, shell=1, stdout=subprocess.PIPE)
+ try:
+ result = p.communicate()[0].strip().split()[1]
+ except IndexError:
+ return 0
+ if sys.version_info >= (3,):
+ result = str(result, sys.stdout.encoding)
+ try:
+ return int(result)
+ except ValueError:
+ return result
+
+def isFreeBSDJail():
+ return isFreeBSD() and sysctl("security.jail.jailed")
+
def getCppCompiler():
compiler = ""
if os.environ.get("CPP_COMPILER", "") != "":
@@ -1846,6 +1865,14 @@
print("%s*** test not supported under Darwin%s" % (prefix, suffix))
continue
+ if isFreeBSD() and "nofreebsd" in config:
+ print("%s*** test not supported under FreeBSD%s" % (prefix, suffix))
+ continue
+
+ if isFreeBSDJail() and "nofreebsdjail" in config:
+ print("%s*** test not supported within a FreeBSD Jail%s" % (prefix, suffix))
+ continue
+
if not isWin32() and "win32only" in config:
print("%s*** test only supported under Win32%s" % (prefix, suffix))
continue
@@ -1929,7 +1929,7 @@
print(" exit 1")
print("fi")
else:
- status = os.system(sys.executable + " " + quoteArgument(os.path.join(dir, "run.py")) + " " + args)
+ status = os.system(sys.executable + " " + quoteArgument(os.path.join(dir, "run.py")) + " " + args) >> 8
if status:
if(num > 0):