Merge vk-gl-cts/vulkan-cts-1.3.0 into vk-gl-cts/vulkan-cts-1.3.1
[platform/upstream/VK-GL-CTS.git] / scripts / launchcontrol_build.py
index 06a2d4f..95a0ff8 100644 (file)
@@ -25,24 +25,48 @@ from build.common import *
 from build.build import *
 from argparse import ArgumentParser
 import multiprocessing
+from build_android_mustpass import *
 
-# This is a bit silly, but CMake needs to know the word width prior to
-# parsing the project files, hence cannot use our own defines.
-X86_64_ARGS = ["-DDE_CPU=DE_CPU_X86_64", "-DCMAKE_C_FLAGS=-m64", "-DCMAKE_CXX_FLAGS=-m64"]
+class LaunchControlConfig:
+       def __init__ (self, buildArgs, checkMustpassLists):
+               self.buildArgs                  = buildArgs
+               self.checkMustpassLists = checkMustpassLists
+
+       def getBuildArgs (self):
+               return self.buildArgs
+
+       def getCheckMustpassLists (self):
+               return self.checkMustpassLists
+
+COMMON_GCC_CFLAGS      = ["-Werror"]
+COMMON_CLANG_CFLAGS    = COMMON_GCC_CFLAGS + ["-Wno-error=unused-command-line-argument"]
+X86_64_GCC_CFLAGS      = COMMON_GCC_CFLAGS + ["-m64"]
+X86_64_CLANG_CFLAGS    = COMMON_CLANG_CFLAGS + ["-m64"]
+
+def makeCflagsArgs (cflags):
+       cflagsStr = " ".join(cflags)
+       return ["-DCMAKE_C_FLAGS=%s" % cflagsStr, "-DCMAKE_CXX_FLAGS=%s" % cflagsStr]
 
 BUILD_CONFIGS = {
-       "gcc-x86_64-x11_glx":   X86_64_ARGS + ["-DDEQP_TARGET=x11_glx"],
-       "clang-x86_64-x11_glx": X86_64_ARGS + ["-DDEQP_TARGET=x11_glx", "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"]
+       "gcc-x86_64-x11_glx":   LaunchControlConfig(["-DDEQP_TARGET=x11_glx"] + makeCflagsArgs(X86_64_GCC_CFLAGS), False),
+       "clang-x86_64-x11_glx": LaunchControlConfig(["-DDEQP_TARGET=x11_glx", "-DCMAKE_C_COMPILER=clang", "-DCMAKE_CXX_COMPILER=clang++"] + makeCflagsArgs(X86_64_CLANG_CFLAGS), False),
+       "gcc-x86_64-null":              LaunchControlConfig(["-DDEQP_TARGET=null"] + makeCflagsArgs(X86_64_GCC_CFLAGS), True)
 }
 
 def buildWithMake (workingDir):
        pushWorkingDir(workingDir)
        # CMake docs advised this to be the best magic formula...
        threadCount = multiprocessing.cpu_count() + 1
-       print "Invoke make with %d threads" % threadCount
+       print("Invoke make with %d threads" % threadCount)
        execute(["make", "-j%d" % threadCount])
        popWorkingDir()
 
+def checkForChanges ():
+       pushWorkingDir(DEQP_DIR)
+       # If there are changed files, exit code will be non-zero and the script terminates immediately.
+       execute(["git", "diff", "--exit-code"])
+       popWorkingDir()
+
 def parseOptions ():
        parser = ArgumentParser()
 
@@ -68,13 +92,18 @@ def parseOptions ():
 if __name__ == "__main__":
        options = parseOptions()
 
-       print "\n############################################################"
-       print "# %s %s BUILD" % (options.config.upper(), options.buildType.upper())
-       print "############################################################\n"
+       print("\n############################################################")
+       print("# %s %s BUILD" % (options.config.upper(), options.buildType.upper()))
+       print("############################################################\n")
 
+       launchControlConfig = BUILD_CONFIGS[options.config]
        buildDir = os.path.realpath(os.path.normpath(options.buildDir))
-       config = BuildConfig(buildDir, options.buildType, BUILD_CONFIGS[options.config])
+       config = BuildConfig(buildDir, options.buildType, launchControlConfig.getBuildArgs())
        initBuildDir(config, MAKEFILE_GENERATOR)
        buildWithMake(buildDir)
 
-       print "\n--- BUILD SCRIPT COMPLETE"
+       if launchControlConfig.getCheckMustpassLists():
+               genMustpassLists(MUSTPASS_LISTS, MAKEFILE_GENERATOR, config)
+               checkForChanges()
+
+       print("\n--- BUILD SCRIPT COMPLETE")