def check_all(self, zipcontents): try: zipfile = io.BytesIO(zipcontents) zip_data = iocollect.extract_zip(zipfile) # contents of output zipfile produced by `python zipout.py` as a dict except: logging.error("Could not process zip file") return None # check if references has subdirectories try: ref_subdirs = iocollect.getdirs(os.path.abspath(self.ref_dir)) except: logging.error("Internal Error: Could not find references.") return None if len(ref_subdirs) > 0: for subdir in ref_subdirs: try: files = iocollect.getfiles(os.path.abspath(os.path.join(self.ref_dir, subdir))) except: logging.error("Internal Error: Could not find references.") return None self.check_path(subdir, files, zip_data) else: try: files = iocollect.getfiles(os.path.abspath(self.ref_dir)) except: logging.error("Internal Error: Could not find references.") return None self.check_path(None, files, zip_data) if len(self.perf.keys()) == 0: return None return self.perf
def check_all(self, zipcontents): zipfile = io.BytesIO(zipcontents) zip_data = iocollect.extract_zip(zipfile) # contents of output zipfile produced by `python zipout.py` as a dict # check if references has subdirectories ref_subdirs = iocollect.getdirs(os.path.abspath(self.ref_dir)) if len(ref_subdirs) > 0: for subdir in ref_subdirs: files = iocollect.getfiles(os.path.abspath(os.path.join(self.ref_dir, subdir))) self.check_path(subdir, files, zip_data) else: files = iocollect.getfiles(os.path.abspath(self.ref_dir)) self.check_path(None, files, zip_data) return self.perf
def run_all(self): # check that a compiled binary exists to run on the input files argv = os.path.abspath(os.path.join(self.answer_dir, self.run_program)) if not (os.path.isfile(argv)): logging.error("answer program missing: {}".format(argv)) raise ValueError("Compile your source file to create an executable {}".format(argv)) # check if input directory has subdirectories testcase_subdirs = iocollect.getdirs(os.path.abspath(self.input_dir)) if len(testcase_subdirs) > 0: for subdir in testcase_subdirs: files = iocollect.getfiles(os.path.abspath(os.path.join(self.testcase_dir, subdir))) self.run_path(subdir, files) else: files = iocollect.getfiles(os.path.abspath(self.input_dir)) self.run_path(None, files) return True
def run_all(self): # check that a compiled binary exists to run on the testcases argv = os.path.abspath(os.path.join(self.answer_dir, self.run_program)) if not (os.path.isfile(argv) and os.access(argv, os.X_OK)): logging.error("executable missing: {0}".format(argv)) print >>sys.stderr, "Compile your source file to create an executable {0}".format(argv) sys.exit(1) # check if testcases has subdirectories testcase_subdirs = iocollect.getdirs(os.path.abspath(self.testcase_dir)) if len(testcase_subdirs) > 0: for subdir in testcase_subdirs: files = iocollect.getfiles(os.path.abspath(os.path.join(self.testcase_dir, subdir))) self.run_path(subdir, files) else: files = iocollect.getfiles(os.path.abspath(self.testcase_dir)) self.run_path(None, files) return True
def run_all(self): # check that a compiled binary exists to run on the testcases argv = os.path.abspath(os.path.join(self.answer_dir, self.run_program)) if not (os.path.isfile(argv) and os.access(argv, os.X_OK)): logging.error("executable missing: {}".format(argv)) print >>sys.stderr, "Compile your source file to create an executable {}".format(argv) sys.exit(1) # check if testcases has subdirectories testcase_subdirs = iocollect.getdirs(os.path.abspath(self.testcase_dir)) if len(testcase_subdirs) > 0: for subdir in testcase_subdirs: files = iocollect.getfiles(os.path.abspath(os.path.join(self.testcase_dir, subdir))) self.run_path(subdir, files) else: files = iocollect.getfiles(os.path.abspath(self.testcase_dir)) self.run_path(None, files) return True