def runTest(self): RequiresRpminspect.configFile(self) p = subprocess.Popen([self.rpminspect, '42'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) p.communicate() self.assertNotEqual(p.returncode, 139)
def setUp(self): RequiresRpminspect.setUp(self) # create a temporary directory to build an SRPM self.tmpdir = tempfile.TemporaryDirectory() # copy things in to the temporary directory shutil.copyfile(self.rpminspect, os.path.join(self.tmpdir.name, "rpminspect")) self.specfile = os.path.join(self.tmpdir.name, "rpminspect.spec") sf = open(self.specfile, "w") if have_old_rpm: sf.write(good_tabbed_group_spec_file) else: sf.write(good_tabbed_spec_file) sf.close() # create the test SRPM (undefine dist to make a predictable # SRPM filename) args = [ "rpmbuild", "--define", "_topdir %s" % self.tmpdir.name, "--define", "_builddir %s" % self.tmpdir.name, "--define", "_rpmdir %s" % self.tmpdir.name, "--define", "_sourcedir %s" % self.tmpdir.name, "--define", "_specdir %s" % self.tmpdir.name, "--define", "_srcrpmdir %s" % self.tmpdir.name, "--define", "_buildrootdir %s" % self.tmpdir.name, "-bs", os.path.join(self.tmpdir.name, "rpminspect.spec"), ] if not have_old_rpm: args.insert(1, "dist") args.insert(1, "--undefine") p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() self.srpm = os.path.join(self.tmpdir.name, "example-0.1-4.7.src.rpm") # the inspection we are checking self.exitcode = 0 self.inspection = "disttag" self.result = "OK" self.waiver_auth = "Not Waivable"
def runTest(self): RequiresRpminspect.configFile(self) p = subprocess.Popen([self.rpminspect, '--help'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) (out, err) = p.communicate() self.assertEqual(p.returncode, 0) out = out.splitlines() t1 = list(filter(lambda x: x.startswith(b'Usage:'), out)) t2 = list(filter(lambda x: x.startswith(b'Options:'), out)) self.assertEqual(len(t1), 1) self.assertEqual(len(t2), 1)
def tearDown(self): self.tmpdir.cleanup() RequiresRpminspect.tearDown(self)