comparison mx/commands.py @ 4630:ef0ff914c10f

Make it possible to pass jvm args in jtt and unittest
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 17 Feb 2012 14:47:48 +0100
parents ebd98fc68b67
children b1b78a46b907
comparison
equal deleted inserted replaced
4629:29da09bf4930 4630:ef0ff914c10f
507 def unittest(args): 507 def unittest(args):
508 """run the Graal Compiler Unit Tests in the GraalVM 508 """run the Graal Compiler Unit Tests in the GraalVM
509 509
510 If filters are supplied, only tests whose fully qualified name 510 If filters are supplied, only tests whose fully qualified name
511 include a filter as a substring are run. Negative filters are 511 include a filter as a substring are run. Negative filters are
512 those with a '-' prefix.""" 512 those with a '-' prefix. VM args should have a @ prefix."""
513 513
514 pos = [a for a in args if a[0] != '-'] 514 pos = [a for a in args if a[0] != '-' and a[0] != '@' ]
515 neg = [a[1:] for a in args if a[0] == '-'] 515 neg = [a[1:] for a in args if a[0] == '-']
516 vmArgs = [a[1:] for a in args if a[0] == '@']
516 517
517 def containsAny(c, substrings): 518 def containsAny(c, substrings):
518 for s in substrings: 519 for s in substrings:
519 if s in c: 520 if s in c:
520 return True 521 return True
529 if len(pos) != 0: 530 if len(pos) != 0:
530 classes = [c for c in classes if containsAny(c, pos)] 531 classes = [c for c in classes if containsAny(c, pos)]
531 if len(neg) != 0: 532 if len(neg) != 0:
532 classes = [c for c in classes if not containsAny(c, neg)] 533 classes = [c for c in classes if not containsAny(c, neg)]
533 534
534 vm(['-XX:-BootstrapGraal', '-esa', '-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) 535 vm(['-XX:-BootstrapGraal', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes)
535 536
536 def jtt(args): 537 def jtt(args):
537 """run the Java Tester Tests in the GraalVM 538 """run the Java Tester Tests in the GraalVM
538 539
539 If filters are supplied, only tests whose fully qualified name 540 If filters are supplied, only tests whose fully qualified name
540 include a filter as a substring are run. Negative filters are 541 include a filter as a substring are run. Negative filters are
541 those with a '-' prefix.""" 542 those with a '-' prefix. VM args should have a @ prefix."""
542 543
543 pos = [a for a in args if a[0] != '-'] 544 pos = [a for a in args if a[0] != '-' and a[0] != '@' ]
544 neg = [a[1:] for a in args if a[0] == '-'] 545 neg = [a[1:] for a in args if a[0] == '-']
546 vmArgs = [a[1:] for a in args if a[0] == '@']
545 547
546 def containsAny(c, substrings): 548 def containsAny(c, substrings):
547 for s in substrings: 549 for s in substrings:
548 if s in c: 550 if s in c:
549 return True 551 return True
558 if len(pos) != 0: 560 if len(pos) != 0:
559 classes = [c for c in classes if containsAny(c, pos)] 561 classes = [c for c in classes if containsAny(c, pos)]
560 if len(neg) != 0: 562 if len(neg) != 0:
561 classes = [c for c in classes if not containsAny(c, neg)] 563 classes = [c for c in classes if not containsAny(c, neg)]
562 564
563 vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa', '-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes) 565 vm(['-XX:-BootstrapGraal', '-XX:CompileOnly=::test', '-Xcomp', '-esa'] + vmArgs + ['-cp', mx.classpath(proj), 'org.junit.runner.JUnitCore'] + classes)
564 566
565 def buildvms(args): 567 def buildvms(args):
566 """build one or more VMs in various configurations""" 568 """build one or more VMs in various configurations"""
567 569
568 parser = ArgumentParser(prog='mx buildvms'); 570 parser = ArgumentParser(prog='mx buildvms');