def check_root(self, prefix='', output=None):
self.init(prefix)
args = "--have-eh --abort-on-fail --root --error-printer"
if self.cxxtest_import:
os.chdir(currdir)
cxxtest.cxxtestgen.main(['cxxtestgen', self.fog, '-o', self.py_cpp]+re.split('[ ]+',args), True)
else:
cmd = join_commands("cd %s" % currdir,
"%s %s../bin/cxxtestgen %s -o %s %s > %s 2>&1" % (sys.executable, currdir, self.fog, self.py_cpp, args, self.py_out))
status = subprocess.call(cmd, shell=True)
self.assertEqual(status, 0, 'Error executing cxxtestgen')
#
files = [self.py_cpp]
for i in [1,2]:
args = "--have-eh --abort-on-fail --part Part%s.h" % str(i)
file = currdir+self.prefix+'_py%s.cpp' % str(i)
files.append(file)
if self.cxxtest_import:
os.chdir(currdir)
cxxtest.cxxtestgen.main(['cxxtestgen', self.fog, '-o', file]+re.split('[ ]+',args), True)
else:
cmd = join_commands("cd %s" % currdir,
"%s %s../bin/cxxtestgen %s -o %s %s > %s 2>&1" % (sys.executable, currdir, self.fog, file, args, self.py_out))
status = subprocess.call(cmd, shell=True)
self.assertEqual(status, 0, 'Error executing cxxtestgen')
#
cmd = join_commands("cd %s" % currdir,
"%s %s %s %s. %s%s../ %s > %s 2>&1" % (self.compiler, self.exe_option, self.build_target, self.include_option, self.include_option, currdir, ' '.join(files), self.build_log))
status = subprocess.call(cmd, shell=True)
for file in files:
if os.path.exists(file):
os.remove(file)
self.assertEqual(status, 0, 'Error executing command: '+cmd)
#
cmd = join_commands("cd %s" % currdir,
"%s %s -v > %s 2>&1" % (self.valgrind, self.build_target, self.px_pre))
status = subprocess.call(cmd, shell=True)
OUTPUT = open(self.px_pre,'a')
OUTPUT.write('Error level = '+str(status)+'\n')
OUTPUT.close()
diffstr = file_diff(self.px_pre, currdir+output, self.file_filter)
if not diffstr == '':
self.fail("Unexpected differences in output:\n"+diffstr)
if self.valgrind != '':
self.parse_valgrind(self.px_pre)
#
self.passed=True
评论列表
文章目录