Exemplo n.º 1
0
def test(lab):
	print "\n\nUNIT TESTS"
	pathString = path.buildPath(lab)
	f = open(pathString + 'config.cfg')
	# ignore variant and programm aim
	f.readline()
	f.readline()
	#run unit testing
	line = f.readline().rstrip('\n')
	flag = 0
	while line:
		print("Test: " + line)
		makeStatus = builder.build(pathString, line)
		string = "make status: " + successOrFail(makeStatus)
		testStatus = 0
		# Print make status
		print(string)
		if makeStatus == 0:
			testStatus = starter.executeAim(pathString + line)
			string = "test status: " + successOrFail(testStatus)
			# Print test status
			print(string)
		flag = flag | makeStatus | testStatus
		line = f.readline().rstrip('\n')
	f.close()
	return flag
Exemplo n.º 2
0
def test(lab):
	global flag
	print("\nPROGRAM TESTS")
	#get variant and program aim from student's config
	programPath = path.buildPath(lab)
	f = open(programPath + 'config.cfg')
	variant = f.readline().rstrip('\n')
	programAim = f.readline().rstrip('\n')
	f.close;
	
	testsPath = path.buildTestPath(int(lab[-1]))
	builder.build(programPath, programAim)
	os.chmod(programPath, 0o777)
	os.chmod(programPath + programAim, 0o777)
	
	# Common tests
	print('Common tests:')
	execute(testsPath, 'config.xml', programPath, programAim)
	# Variant tests
	print('\nVariant tests:')
	#execute(testsPath, 'config' + str(variant) + '.xml', programPath, programAim)
	return flag