def test_03_system_files(self): targets = TC.get_random_system_files(50, "/etc/*") open(self.listfile, "w").write("%s\n" % "\n".join(targets)) TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_00_generated_file(self): target = os.path.join(self.workdir, "aaa.txt") open(target, "w").write("\n") open(self.listfile, "w").write("%s\n" % target) TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_02_system_file(self): while True: target = TC.get_random_system_files(1, "/etc/*") if os.access(target, os.R_OK): break open(self.listfile, "w").write("%s\n" % target) TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_03_system_files(self): targets = TC.get_random_system_files(50, "/etc/*") targets += TC.get_random_system_files(20, "/usr/share/*/*") targets += TC.get_random_system_files(10, "/var/run/*") targets += TC.get_random_system_files(10, "/var/tmp/*") open(self.listfile, "w").write("%s\n" % "\n".join(targets)) self.args += ["--stepto", "sbuild"] TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_02_system_file(self): target = TC.get_random_system_files(1, "/etc/*") open(self.listfile, "w").write("%s\n" % target) TC.run_w_args(self.args, self.workdir) try: self.__assertExists(self.pkgfile) except: print "target=" + target raise
def test_00_generated_file(self): if E.json is None: return target = os.path.join(self.workdir, "aaa.txt") open(target, "w").write("test\n") data = {"files": [{"path": target}]} E.json.dump(data, open(self.listfile, "w")) self.args += ["--input-type", "filelist.json"] TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_01_generated_files(self): os.makedirs(os.path.join(self.workdir, "b")) os.makedirs(os.path.join(self.workdir, "b", "c")) targets = [ os.path.join(self.workdir, "aaa.txt"), os.path.join(self.workdir, "b", "d.x"), os.path.join(self.workdir, "b", "c", "e"), ] for t in targets: open(t, "w").write("\n") open(self.listfile, "w").write("%s\n" % "\n".join(targets)) TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_01_system_files(self): if E.json is None: return targets = TC.get_random_system_files(50, "/etc/*") targets += TC.get_random_system_files(20, "/usr/share/*/*") targets += TC.get_random_system_files(10, "/var/run/*") targets += TC.get_random_system_files(10, "/var/tmp/*") files = [{"path": p} for p in targets] data = {"files": files} E.json.dump(data, open(self.listfile, "w")) self.args += ["--input-type", "filelist.json"] TC.run_w_args(self.args, self.workdir) self.__assertExists(self.pkgfile)
def test_02_system_file(self): target = None while True: targets = TC.get_random_system_files(20, "/etc/*") targets = [t for t in targets if os.access(t, os.R_OK)] if targets: target = targets[0] break if target is None: logging.warn("Could not find accessible system file!") return open(self.listfile, "w").write("%s\n" % target) TC.run_w_args(self.args, self.workdir) try: self.__assertExists(self.pkgfile) except: print "target=" + target raise