1 #!/usr/bin/python2 2 """Check to see if the working set produces a good executable. 3 4 This test script is made for the noincremental-prune test. This makes sure 5 that, after pruning starts (>1 bad item is found), that the number of args sent 6 to the switch scripts is equals to the actual number of items (i.e. checking 7 that noincremental always holds). 8 """ 9 10 from __future__ import print_function 11 12 import os 13 import sys 14 15 import common 16 17 18 def Main(): 19 working_set = common.ReadWorkingSet() 20 21 with open('noinc_prune_good', 'r') as good_args: 22 num_good_args = len(good_args.readlines()) 23 24 with open('noinc_prune_bad', 'r') as bad_args: 25 num_bad_args = len(bad_args.readlines()) 26 27 num_args = num_good_args + num_bad_args 28 if num_args != len(working_set): 29 print('Only %d args, expected %d' % (num_args, len(working_set))) 30 print('%d good args, %d bad args' % (num_good_args, num_bad_args)) 31 return 3 32 33 os.remove('noinc_prune_bad') 34 os.remove('noinc_prune_good') 35 36 if not os.path.exists('./is_setup'): 37 return 1 38 for w in working_set: 39 if w == 1: 40 return 1 ## False, linking failure 41 return 0 42 43 44 if __name__ == '__main__': 45 retval = Main() 46 sys.exit(retval) 47