mirror of
https://github.com/servo/servo.git
synced 2025-06-14 11:24:33 +00:00
Skipping mutation test for file with local changes
This commit is contained in:
parent
ffbabf4a4c
commit
d24d6ac8ef
1 changed files with 28 additions and 24 deletions
|
@ -33,28 +33,32 @@ def mutate_random_line(file_name):
|
||||||
|
|
||||||
|
|
||||||
def mutation_test(file_name, tests):
|
def mutation_test(file_name, tests):
|
||||||
mutated_line = mutate_random_line(file_name)
|
local_changes_present = subprocess.call('git diff --quiet {0}'.format(file_name), shell=True)
|
||||||
if mutated_line != -1:
|
if local_changes_present == 1:
|
||||||
print "Mutating {0} at line {1}".format(file_name, mutated_line)
|
print "{0} has local changes, please commit/remove changes before running the test".format(file_name)
|
||||||
print "compling mutant {0}:{1}".format(file_name, mutated_line)
|
|
||||||
sys.stdout.flush()
|
|
||||||
subprocess.call('python mach build --release', shell=True, stdout=DEVNULL)
|
|
||||||
for test in tests:
|
|
||||||
test_command = "python mach test-wpt {0} --release".format(test.encode('utf-8'))
|
|
||||||
print "running `{0}` test for mutant {1}:{2}".format(test, file_name, mutated_line)
|
|
||||||
sys.stdout.flush()
|
|
||||||
test_status = subprocess.call(test_command, shell=True, stdout=DEVNULL)
|
|
||||||
if test_status != 0:
|
|
||||||
print("Failed: while running `{0}`".format(test_command))
|
|
||||||
print "mutated file {0} diff".format(file_name)
|
|
||||||
sys.stdout.flush()
|
|
||||||
subprocess.call('git --no-pager diff {0}'.format(file_name), shell=True)
|
|
||||||
else:
|
|
||||||
print("Success: Mutation killed by {0}".format(test.encode('utf-8')))
|
|
||||||
break
|
|
||||||
print "reverting mutant {0}:{1}".format(file_name, mutated_line)
|
|
||||||
sys.stdout.flush()
|
|
||||||
subprocess.call('git checkout {0}'.format(file_name), shell=True)
|
|
||||||
else:
|
else:
|
||||||
print "Cannot mutate {0}".format(file_name)
|
mutated_line = mutate_random_line(file_name)
|
||||||
print "-----------------------------------------------------------------\n"
|
if mutated_line != -1:
|
||||||
|
print "Mutating {0} at line {1}".format(file_name, mutated_line)
|
||||||
|
print "compling mutant {0}:{1}".format(file_name, mutated_line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
subprocess.call('python mach build --release', shell=True, stdout=DEVNULL)
|
||||||
|
for test in tests:
|
||||||
|
test_command = "python mach test-wpt {0} --release".format(test.encode('utf-8'))
|
||||||
|
print "running `{0}` test for mutant {1}:{2}".format(test, file_name, mutated_line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
test_status = subprocess.call(test_command, shell=True, stdout=DEVNULL)
|
||||||
|
if test_status != 0:
|
||||||
|
print("Failed: while running `{0}`".format(test_command))
|
||||||
|
print "mutated file {0} diff".format(file_name)
|
||||||
|
sys.stdout.flush()
|
||||||
|
subprocess.call('git --no-pager diff {0}'.format(file_name), shell=True)
|
||||||
|
else:
|
||||||
|
print("Success: Mutation killed by {0}".format(test.encode('utf-8')))
|
||||||
|
break
|
||||||
|
print "reverting mutant {0}:{1}".format(file_name, mutated_line)
|
||||||
|
sys.stdout.flush()
|
||||||
|
subprocess.call('git checkout {0}'.format(file_name), shell=True)
|
||||||
|
else:
|
||||||
|
print "Cannot mutate {0}".format(file_name)
|
||||||
|
print "-----------------------------------------------------------------\n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue