Example #1
0
 def setUp(self):
     BaseTest.setUp(self)
     os.environ["PATH"] = os.pathsep.join(
         [os.environ["PATH"],
          os.path.abspath(os.path.dirname(__file__))])
     self.tmp_file = self.get_tmp_file(0)
     self.config = configfile.ConfigurationDescription(self.tmp_file)
     package = configfile.PackageDescription('test')
     package.license = "LGPL"
     package.copyright = "copy left"
     package.license_file = "LICENSES/file"
     platform = configfile.PlatformDescription()
     build_configuration = configfile.BuildConfigurationDescription()
     # Formally you might consider that noop.py is an "argument" rather
     # than an "option" -- but the way Executable is structured, if we pass
     # it as an "argument" then the "build" subcommand gets inserted before
     # it, which thoroughly confuses the Python interpreter.
     build_configuration.configure = \
         Executable(command=sys.executable,
                    options=[os.path.join(os.path.dirname(__file__), "noop.py")])
     build_configuration.default = True
     build_configuration.name = 'Release'
     platform.configurations['Release'] = build_configuration
     package.platforms[common.get_current_platform()] = platform
     self.config.package_description = package
     self.config.save()
Example #2
0
 def get_config(self):
     config = configfile.ConfigurationDescription(self.tmp_file)
     package = configfile.PackageDescription('test')
     package.license = "LGPL"
     package.license_file="LICENSES/file"
     package.copyright="copy right"
     platform = configfile.PlatformDescription()
     platform.build_directory = self.tmp_build_dir
     package.version_file = os.path.join(self.tmp_build_dir, "version.txt")
     with open(package.version_file, "w") as vf:
         vf.write("1.0\n")
     build_configuration = configfile.BuildConfigurationDescription()
     # Formally you might consider that noop.py is an "argument" rather
     # than an "option" -- but the way Executable is structured, if we pass
     # it as an "argument" then the "build" subcommand gets inserted before
     # it, which thoroughly confuses the Python interpreter.
     build_configuration.build = \
         Executable(command=sys.executable,
                    options=[os.path.join(os.path.dirname(__file__), "noop.py")])
     build_configuration.default = True
     build_configuration.name = 'Release'
     platform.configurations['Release'] = build_configuration
     package.platforms[common.get_current_platform()] = platform
     config.package_description = package
     return config
Example #3
0
 def test_disallowed_paths(self):
     self.options = PackageOptions(self.data_dir)
     config_template = os.path.join(
         self.data_dir, "autobuild-package-disallowedpath-config.xml")
     # earlier tests establish the 'common' platform
     # clear that out so that this test uses both the current and common
     del os.environ['AUTOBUILD_PLATFORM']
     del os.environ['AUTOBUILD_PLATFORM_OVERRIDE']
     common.Platform = None
     self.platform = common.get_current_platform()
     logger.debug("platform " + self.platform)
     self.options.platform = self.platform
     platform_config = self.platform + "-autobuild-package-disallowedpath-config.xml"
     self.instantiateTemplate(config_template, platform_config,
                              {'PLATFORM': self.platform})
     self.options.autobuild_filename = platform_config
     # it's hard to come up with a root path (such as /etc/passwd) that will be on all platforms
     # so we use "/" here; if you use some /etc/passwd, you get a different exception
     # (No files matched manifest specifiers) when the file does not exist
     badpaths = [
         "include/../include/file1", "include/../file2",
         "../package-test/include/file1", "include/..", "/"
     ]
     with ExpectError(
             "Absolute paths or paths with parent directory elements are not allowed:\n  "
             + '\n  '.join(sorted(badpaths)) + "\n",
             "Bad paths not detected"):
         package.AutobuildTool().run(self.options)
Example #4
0
 def test_id(self):
     self.config.package_description.platforms[common.get_current_platform()] \
         .configurations['Release'].build = \
         Executable("echo", arguments=["foo$AUTOBUILD_BUILD_ID"])
     self.config.save()
     assert "foo666" in self.autobuild('build', '--config-file=' + self.tmp_file,
                                     '-i', '666')
    def test_find_executable(self):
        shell = "sh"
        if common.get_current_platform() == common.PLATFORM_WINDOWS:
            shell = "cmd"

        exe_path = common.find_executable(shell)
        assert exe_path != None
Example #6
0
    def test_find_executable(self):
        shell = "sh"
        if common.get_current_platform() == common.PLATFORM_WINDOWS:
            shell = "cmd"

        exe_path = common.find_executable(shell)
        assert exe_path != None
 def setUp(self):
     os.environ["PATH"] = os.pathsep.join([os.environ["PATH"], os.path.abspath(os.path.dirname(__file__))])
     self.tmp_file = self.get_tmp_file(4)
     self.config = configfile.ConfigurationDescription(self.tmp_file)
     package = configfile.PackageDescription('test')
     working_platform = configfile.PlatformDescription()
     common_platform = configfile.PlatformDescription()
     package.platforms[common.get_current_platform()] = working_platform
     package.platforms['common'] = common_platform
     self.config.package_description = package
Example #8
0
 def test_substitutions(self):
     self.config.package_description.platforms[common.get_current_platform()] \
         .configurations['Release'].configure = \
         Executable("echo", arguments=["foo$AUTOBUILD_ADDRSIZE"])
     self.config.save()
     assert "foo32" in self.autobuild('configure',
                                      '--config-file=' + self.tmp_file,
                                      '-A', '32')
     assert "foo64" in self.autobuild('configure',
                                      '--config-file=' + self.tmp_file,
                                      '-A', '64')
Example #9
0
 def get_config(self):
     config = super(TestEnvironment, self).get_config()
     config.package_description.copyright="no copy"
     # Formally you might consider that noop.py is an "argument" rather
     # than an "option" -- but the way Executable is structured, if we pass
     # it as an "argument" then the "build" subcommand gets inserted before
     # it, which thoroughly confuses the Python interpreter.
     config.package_description.platforms[common.get_current_platform()] \
           .configurations["Release"].build = \
           Executable(command=sys.executable,
                      options=[os.path.join(os.path.dirname(__file__), "envtest.py")])
     return config
Example #10
0
 def setUp(self):
     BaseTest.setUp(self)
     os.environ["PATH"] = os.pathsep.join(
         [os.environ["PATH"],
          os.path.abspath(os.path.dirname(__file__))])
     self.tmp_file = self.get_tmp_file(4)
     self.config = configfile.ConfigurationDescription(self.tmp_file)
     package = configfile.PackageDescription('test')
     package.license = 'Public Domain'
     working_platform = configfile.PlatformDescription()
     common_platform = configfile.PlatformDescription()
     package.platforms[common.get_current_platform()] = working_platform
     package.platforms['common'] = common_platform
     self.config.package_description = package
 def setUp(self):
     os.environ["PATH"] = os.pathsep.join([os.environ["PATH"], os.path.abspath(os.path.dirname(__file__))])
     self.tmp_file = self.get_tmp_file(0)
     self.config = configfile.ConfigurationDescription(self.tmp_file)
     package = configfile.PackageDescription('test')
     platform = configfile.PlatformDescription()
     build_configuration = configfile.BuildConfigurationDescription()
     build_configuration.configure = Executable(command="noop.py")
     build_configuration.default = True
     build_configuration.name = 'Release'
     platform.configurations['Release'] = build_configuration
     package.platforms[common.get_current_platform()] = platform
     self.config.package_description = package
     self.config.save()
Example #12
0
 def test_package_missing(self):
     self.options = PackageOptions(self.data_dir)
     config_template = os.path.join(self.data_dir,
                                    "autobuild-package-missing-config.xml")
     # earlier tests establish the 'common' platform
     # clear that out so that this test uses both the current and common
     del os.environ['AUTOBUILD_PLATFORM']
     del os.environ['AUTOBUILD_PLATFORM_OVERRIDE']
     common.Platform = None
     self.platform = common.get_current_platform()
     logger.debug("platform " + self.platform)
     self.options.platform = self.platform
     platform_config = self.platform + "-autobuild-package-missing-config.xml"
     self.instantiateTemplate(config_template, platform_config,
                              {'PLATFORM': self.platform})
     self.options.autobuild_filename = platform_config
     with ExpectError(
             "No files matched manifest specifiers:\n" +
             '\n'.join(["missing/\*.txt", "not_there.txt"]),
             "Missing files not detected"):
         package.AutobuildTool().run(self.options)
Example #13
0
 def get_config(self):
     config = super(TestSubstitutions, self).get_config()
     config.package_description.platforms[common.get_current_platform()] \
           .configurations['Release'].build = \
           Executable("echo", arguments=["foo$AUTOBUILD_ADDRSIZE"])
     return config