comparison mx/commands.py @ 9097:a0ab945fb95f

build output during buildvms command is sent to console (instead of log files) if -c option is given
author Doug Simon <doug.simon@oracle.com>
date Fri, 12 Apr 2013 22:13:26 +0200
parents d4b868ed9cfb
children d766fd8eede0
comparison
equal deleted inserted replaced
9096:d4b868ed9cfb 9097:a0ab945fb95f
844 844
845 parser = ArgumentParser(prog='mx buildvms'); 845 parser = ArgumentParser(prog='mx buildvms');
846 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault) 846 parser.add_argument('--vms', help='a comma separated list of VMs to build (default: ' + vmsDefault + ')', metavar='<args>', default=vmsDefault)
847 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault) 847 parser.add_argument('--builds', help='a comma separated list of build types (default: ' + vmbuildsDefault + ')', metavar='<args>', default=vmbuildsDefault)
848 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build') 848 parser.add_argument('-n', '--no-check', action='store_true', help='omit running "java -version" after each build')
849 parser.add_argument('-c', '--console', action='store_true', help='send build output to console instead of log file')
849 850
850 args = parser.parse_args(args) 851 args = parser.parse_args(args)
851 vms = args.vms.split(',') 852 vms = args.vms.split(',')
852 builds = args.builds.split(',') 853 builds = args.builds.split(',')
853 854
854 allStart = time.time() 855 allStart = time.time()
855 for v in vms: 856 for v in vms:
856 for vmbuild in builds: 857 for vmbuild in builds:
857 if v == 'server0' and vmbuild != 'product': 858 if v == 'server0' and vmbuild != 'product':
858 continue 859 continue
859 logFile = join(v + '-' + vmbuild + '.log') 860 if not args.console:
860 log = open(join(_graal_home, logFile), 'wb') 861 logFile = join(v + '-' + vmbuild + '.log')
861 start = time.time() 862 log = open(join(_graal_home, logFile), 'wb')
862 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')') 863 start = time.time()
863 # Run as subprocess so that output can be directed to a file 864 mx.log('BEGIN: ' + v + '-' + vmbuild + '\t(see: ' + logFile + ')')
864 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT) 865 # Run as subprocess so that output can be directed to a file
865 duration = datetime.timedelta(seconds=time.time() - start) 866 subprocess.check_call([sys.executable, '-u', join('mxtool', 'mx.py'), '--vm', v, 'build', vmbuild], cwd=_graal_home, stdout=log, stderr=subprocess.STDOUT)
867 duration = datetime.timedelta(seconds=time.time() - start)
868 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']')
869 else:
870 global _vm
871 _vm = v
872 build([vmbuild])
866 if not args.no_check: 873 if not args.no_check:
867 vmargs = ['-version'] 874 vmargs = ['-version']
868 if v == 'graal': 875 if v == 'graal':
869 vmargs.insert(0, '-XX:-BootstrapGraal') 876 vmargs.insert(0, '-XX:-BootstrapGraal')
870 vm(vmargs, vm=v, vmbuild=vmbuild) 877 vm(vmargs, vm=v, vmbuild=vmbuild)
871 mx.log('END: ' + v + '-' + vmbuild + '\t[' + str(duration) + ']')
872 allDuration = datetime.timedelta(seconds=time.time() - allStart) 878 allDuration = datetime.timedelta(seconds=time.time() - allStart)
873 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') 879 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']')
874 880
875 def gate(args): 881 def gate(args):
876 """run the tests used to validate a push 882 """run the tests used to validate a push