Exemplo n.º 1
0
    def test_results(self):
        logger.setLevel(logging.DEBUG)
        results_output = tempfile.mktemp()
        package.package(self.config,
                        self.config.get_build_directory(None, 'common'),
                        'common',
                        archive_format='tbz2',
                        results_file=results_output)
        expected_results_regex = '''\
autobuild_package_name="%s"
autobuild_package_clean="true"
autobuild_package_metadata="%s"
autobuild_package_filename="%s"
autobuild_package_md5="%s"
$''' % ('test1',
        re.escape(
            os.path.join(self.data_dir, "package-test",
                         "autobuild-package.xml")), re.escape(
                             self.tar_name), "[0-9a-f]{32}")
        expected = re.compile(expected_results_regex, flags=re.MULTILINE)
        assert os.path.exists(
            results_output), "results file not found: %s" % results_output
        actual_results = open(results_output, 'r').read()
        assert expected.match(actual_results), \
          "\n!!! expected regex:\n%s\n!!! actual result:\n%s" % (expected_results_regex, actual_results)
        clean_file(results_output)
Exemplo n.º 2
0
    def test_results(self):
        from nose.plugins.skip import SkipTest
        raise SkipTest("pydot not installed, skipping")
        logger.setLevel(logging.DEBUG)
        results_output = tempfile.mktemp()
        package.package(self.config,
                        self.config.get_build_directory(None, 'common'),
                        'common',
                        archive_format='txz',
                        results_file=results_output)
        expected_results_regex = '''\
{
    "autobuild_package_clean": "true",
    "autobuild_package_filename": "%s",
    "autobuild_package_md5": "%s",
    "autobuild_package_metadata": "%s",
    "autobuild_package_name": "%s",
    "autobuild_package_sha256": "%s",
    "autobuild_package_sha3_256": "%s",
    "autobuild_package_sha3_384": "%s",
    "autobuild_package_version": "%s"
}
$''' % (re.escape(os.path.basename(self.tar_name)), "[0-9a-f]{32}",
        re.escape(
            os.path.join(self.data_dir, "package-test",
                         "autobuild-package.xml")), 'test1', "[0-9a-f]{64}",
        "[0-9a-f]{64}", "[0-9a-f]{96}", re.escape("1.0"))
        expected = re.compile(expected_results_regex, flags=re.MULTILINE)
        assert os.path.exists(
            results_output), "results file not found: %s" % results_output
        actual_results = open(results_output, 'r').read()
        assert expected.match(actual_results), \
          "\n!!! expected regex:\n%s\n!!! actual result:\n%s" % (expected_results_regex, actual_results)
        clean_file(results_output)
Exemplo n.º 3
0
 def test_package(self):
     logger.setLevel(logging.DEBUG)
     package.package(self.config,
                     self.config.get_build_directory(None, 'common'),
                     'common',
                     archive_format='tbz2')
     assert os.path.exists(
         self.tar_name), "%s does not exist" % self.tar_name
     self.tar_has_expected(self.tar_name)
Exemplo n.º 4
0
 def test_package_other_version(self):
     # read the existing metadata file and update stored package version
     build_directory = self.config.get_build_directory(None, 'common')
     metadata_filename = os.path.join(build_directory,
                                      configfile.PACKAGE_METADATA_FILE)
     metadata = configfile.MetadataDescription(metadata_filename)
     metadata.package_description.version = "2.3"
     metadata.save()
     # okay, now use that to build package
     package.package(self.config,
                     build_directory,
                     'common',
                     archive_format='tbz2')
     # should have used updated package version in tarball name
     expected_tar_name = self.tar_name.replace("-1.0-", "-2.3-")
     if not os.path.exists(expected_tar_name):
         if os.path.exists(self.tar_name):
             raise AssertionError("package built %s instead of %s" %
                                  (self.tar_name, expected_tar_name))
         raise AssertionError("package built neither %s nor %s" %
                              (self.tar_name, expected_tar_name))
Exemplo n.º 5
0
 def test_package(self):
     package.package(self.config, 'linux', self.tar_name)
     assert os.path.exists(self.tar_name)
     tarball = tarfile.open(self.tar_name)
     assert [os.path.basename(f) for f in tarball.getnames()].sort() == \
         ['file3', 'file1', 'test1.txt'].sort()