1#!/usr/bin/python 2import os,sys 3import subprocess 4 5 6print "Scroll down for summary" 7print "" 8print "" 9 10f = open('MODTREE') 11mods = {} 12commands = [] 13 14def get_deps(mod): 15 if not mod in mods.keys(): 16 return [] 17 deps = mods[mod] 18 retlist = [mod] 19 for i in deps.split(' '): 20 retlist.append(i) 21 for j in get_deps(i): 22 retlist.append(j) 23 return retlist 24 25 26while(True): 27 r = f.readline() 28 if r == '': 29 break 30 if r != '\n': 31 strings = r.split(':') 32 mod = strings[0] 33 deps = strings[1].rstrip('\n') 34 mods[mod] = deps.strip(' ') 35 36for k,v in mods.iteritems(): 37 command = 'make dummy ' 38 deps = get_deps(k) 39 for i in mods.keys(): 40 if i in deps: 41 command += i + "=1 " 42 else: 43 command += i + "=0 " 44 commands.append(command) 45 46endResult = [] 47failed = 0 48 49for i in commands: 50 print 'Checking config:\n\t%s' % i 51 52 subprocess.call(['make','clean']) 53 sys.stdout.flush() 54 sys.stderr.flush() 55 56 args = i.split(' ') 57 58 # Remove the last item (which is a blank) 59 ret = subprocess.call(args[:-1]) 60 sys.stdout.flush() 61 sys.stderr.flush() 62 63 if ret == 0: 64 print "**********************************************************" 65 print "******************* CONFIG PASSED! *******************" 66 endResult.append({"test": i, "result": "PASS"}) 67 else: 68 failed += 1 69 print "**********************************************************" 70 print "******************* CONFIG FAILED! *******************" 71 endResult.append({"test": i, "result": "FAIL"}) 72 print "**********************************************************" 73 74print "" 75print "***************************************************************************" 76print " Executive Summary" 77print "***************************************************************************" 78print "" 79 80for r in endResult: 81 print "Test:", r["test"] 82 print "Status:", r["result"] 83 print "" 84 85print "***********************" 86print "%d out of %d Failed" % (failed, len(endResult)) 87print "***********************" 88 89if failed: 90 sys.exit(1) 91else: 92 sys.exit(0) 93