def testfunc(control_src, test_src, in_data): control_src = os.path.join(self.cpp_validate_dir, control_src) test_src = os.path.join(self.cpp_validate_dir, test_src) inpath = os.path.join(self.staging_dir_wd, 'test.in.data') with open(inpath, 'wb') as infile: infile.write(listtodata(in_data)) util.set_tempfile(inpath) return cpp_validate._compile_run_test_validate_time(control_src, test_src, inpath)
def test__write_generated_code(self): def testfunc(testprocfile, srcname, destname, defines): srcpath = os.path.join(self.cpp_validate_dir, srcname) with open(os.path.join(self.cpp_validate_dir, testprocfile),'r') as f: testproc = cpp_validate._parse_testproc_script(f.read()) return cpp_validate._write_generated_code(testproc, srcpath, defines, destname, self.staging_dir_wd) for args, exp_path in self._write_generated_code_test_data: val_path = testfunc(*args) util.set_tempfile(val_path) exp_path = os.path.join(self.cpp_validate_dir, exp_path) with open(val_path, 'r') as valfile: with open(exp_path, 'r') as expfile: self.assertEqual(valfile.read().splitlines(), expfile.read().splitlines())
def makeobj(src, obj): src_path = os.path.join(self.cpp_validate_dir, src) obj_path = os.path.join(self.staging_dir_wd, obj) util.shell('g++', ['-o', obj_path, src_path, '-lrt']) util.set_tempfile(obj_path) return src_path, obj_path