X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fcompilation.py;h=b8b8ce0cf8150b24ff76340da35da6ebbb019baf;hb=553593e49b88404d2934614f2e5190412494e541;hp=4da9566e68f24b437560f944f8b7c58808ebe2ff;hpb=12471302d963debf502d83c9a678406beb825c92;p=tools%2Fsat.git diff --git a/src/compilation.py b/src/compilation.py index 4da9566..b8b8ce0 100644 --- a/src/compilation.py +++ b/src/compilation.py @@ -20,6 +20,7 @@ import os import subprocess import sys import shutil +import glob import src @@ -129,9 +130,8 @@ class Builder: # In case CMAKE_GENERATOR is defined in environment, # use it in spite of automatically detect it if 'cmake_generator' in self.config.APPLICATION: - cmake_option += " -DCMAKE_GENERATOR=%s" \ + cmake_option += " -DCMAKE_GENERATOR=\"%s\"" \ % self.config.APPLICATION.cmake_generator - command = ("cmake %s -DCMAKE_INSTALL_PREFIX=%s %s" % (cmake_option, self.install_dir, self.source_dir)) @@ -262,9 +262,9 @@ CC=\\"hack_libtool\\"%g" libtool''' command = 'msbuild' command = command + " /maxcpucount:" + str(nb_proc) if self.debug_mode: - command = command + " /p:Configuration=Debug" + command = command + " /p:Configuration=Debug /p:Platform=x64 " else: - command = command + " /p:Configuration=Release" + command = command + " /p:Configuration=Release /p:Platform=x64 " command = command + " ALL_BUILD.vcxproj" self.log_command(command) @@ -284,15 +284,14 @@ CC=\\"hack_libtool\\"%g" libtool''' ## # Runs 'make install'. def install(self): - if self.config.VARS.dist_name=="Win": + if src.architecture.is_windows(): command = 'msbuild INSTALL.vcxproj' if self.debug_mode: - command = command + " /p:Configuration=Debug" + command = command + " /p:Configuration=Debug /p:Platform=x64 " else: - command = command + " /p:Configuration=Release" + command = command + " /p:Configuration=Release /p:Platform=x64 " else : command = 'make install' - self.log_command(command) res = subprocess.call(command, @@ -302,17 +301,42 @@ CC=\\"hack_libtool\\"%g" libtool''' stdout=self.logger.logTxtFile, stderr=subprocess.STDOUT) + res_check=self.check_install() + if res_check > 0 : + self.log_command("Error in sat check install - some files are not installed!") self.put_txt_log_in_appli_log_dir("makeinstall") + + res+=res_check if res == 0: return res else: return 1 + # this function checks wether a list of file patterns (specified by check_install keyword) + # exixts after the make install. The objective is to ensure the installation is complete. + # patterns are given relatively to the install dir of the product + def check_install(self): + res=0 + if "check_install" in self.product_info: + self.log_command("Check installation of files") + for pattern in self.product_info.check_install: + # pattern is given relatively to the install dir + complete_pattern=os.path.join(self.product_info.install_dir, pattern) + self.log_command(" -> check %s" % complete_pattern) + # expansion of pattern : takes into account environment variables and unix shell rules + list_of_path=glob.glob(os.path.expandvars(complete_pattern)) + if not list_of_path: + # we expect to find at least one entry, if not we consider the test failed + res+=1 + self.logger.write("Error, sat check install failed for file pattern %s\n" % complete_pattern, 1) + self.log_command("Error, sat check install failed for file pattern %s" % complete_pattern) + return res + ## # Runs 'make_check'. def check(self, command=""): if src.architecture.is_windows(): - cmd = 'msbuild RUN_TESTS.vcxproj' + cmd = 'msbuild RUN_TESTS.vcxproj /p:Configuration=Release /p:Platform=x64 ' else : if self.product_info.build_source=="autotools" : cmd = 'make check' @@ -428,6 +452,7 @@ CC=\\"hack_libtool\\"%g" libtool''' assert self.build_environ is not None # pass additional variables to environment # (may be used by the build script) + self.build_environ.set("APPLICATION_NAME", self.config.APPLICATION.name) self.build_environ.set("SOURCE_DIR", str(self.source_dir)) self.build_environ.set("INSTALL_DIR", str(self.install_dir)) self.build_environ.set("PRODUCT_INSTALL", str(self.install_dir)) @@ -460,7 +485,12 @@ CC=\\"hack_libtool\\"%g" libtool''' cwd=str(self.build_dir), env=self.build_environ.environ.environ) + res_check=self.check_install() + if res_check > 0 : + self.log_command("Error in sat check install - some files are not installed!") + self.put_txt_log_in_appli_log_dir("script") + res += res_check if res == 0: return res else: