def test_publish(self): files = [f for _, f in self.RENAMED_FILES] retcode, stderr = util.run_script(self.symstore_path, files, symfiles_dir=self.renamed_files_dir) self.assertEqual(retcode, 0) self.assertEqual(stderr, b"") self.assertSymstoreDir("renamed.zip")
def test_del_unknown_transaction(self): """ test deleting non-existing transaction """ retcode, stderr = util.run_script(SYMSTORE_PATH, [], ["--delete", "0000000042"]) self.assertEqual(retcode, 1) self.assertRegex(stderr.decode(), "no transaction with id '0000000042' found")
def test_pe_not_found(self): # full path to our non-existing file exe_path = path.join(util.SYMFILES_DIR, self.PE_FILE) # make sure file don't exist self.assertFalse(path.exists(exe_path)) # run the script, and check that we get proper error message retcode, stderr = util.run_script(SYMSTORE_PATH, [self.PE_FILE]) self.assertEqual(retcode, 1) self.assertRegex(stderr.decode(), "No such file: %s" % exe_path)
def test_skip_no_new_files(self): """ test adding one file that already have been published """ retcode, stderr = util.run_script(self.symstore_path, ["dummyprog.pdb"], ["--skip-published"]) # we should get an error message, as there is nothing new to publish self.assertEqual(retcode, 1) self.assertEqual(stderr.decode(), "no new files to publish\n")
def test_truncated_exe(self): """ test adding a truncated PE file, a PE file that contains valid 'PE file' signaure part, but lacks the rest of the contents """ retcode, stderr = util.run_script(SYMSTORE_PATH, ["truncated.exe"]) self.assertEqual(retcode, 1) self.assertRegex(stderr.decode(), ".*truncated.exe: invalid PE file:.*")
def test_unknown_extension(self): filename = "unknown.ext" retcode, stderr = util.run_script(SYMSTORE_PATH, [filename]) self.assertErrorMsg(retcode, stderr, filename, "unknown file extension 'ext'")
def test_no_extension(self): filename = "no_extension" retcode, stderr = util.run_script(SYMSTORE_PATH, [filename]) self.assertErrorMsg(retcode, stderr, filename, "no file extension")
def test_invalid_pdb(self): retcode, stderr = util.run_script(SYMSTORE_PATH, ["invalid.pdb"]) self.assertInvalidPEMsg(retcode, stderr, "PDB", "invalid.pdb")
def test_invalid_exe(self): retcode, stderr = util.run_script(SYMSTORE_PATH, ["invalid.exe"]) self.assertInvalidPEMsg(retcode, stderr, "PE", "invalid.exe")
def test_empty_exe(self): """ will hit 'reading beyond end of file error" """ retcode, stderr = util.run_script(SYMSTORE_PATH, ["empty.exe"]) self.assertInvalidPEMsg(retcode, stderr, "PE", "empty.exe")
def test_invalid_pdb(self): """ will not find valid 'PDB file' signature """ retcode, stderr = util.run_script(SYMSTORE_PATH, ["invalid.pdb"]) self.assertUnknownFileTypeMsg(retcode, stderr, "invalid.pdb")
def test_empty_exe(self): """ will not find valid PE file signature """ retcode, stderr = util.run_script(SYMSTORE_PATH, ["empty.exe"]) self.assertUnknownFileTypeMsg(retcode, stderr, "empty.exe")