Skip to content

Commit

Permalink
Merge pull request #4499 from renfeiw/tkg2
Browse files Browse the repository at this point in the history
Add logic to specify test with different aot tags
  • Loading branch information
llxia committed Feb 1, 2019
2 parents 0d325df + a964a49 commit b167041
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
3 changes: 2 additions & 1 deletion test/TestConfig/playlist.xsd
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
Copyright (c) 2017, 2018 IBM Corp. and others
Copyright (c) 2017, 2019 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -42,6 +42,7 @@
<xs:element type="xs:string" name="disabled" minOccurs="0"/>
<xs:element type="xs:string" name="capabilities" minOccurs="0"/>
<xs:element type="xs:string" name="platformRequirements" minOccurs="0"/>
<xs:element type="xs:string" name="aot"/>
<xs:element name="tags" minOccurs="0">
<xs:complexType>
<xs:sequence>
Expand Down
4 changes: 2 additions & 2 deletions test/TestConfig/run_configure.mk
@@ -1,5 +1,5 @@
##############################################################################
# Copyright (c) 2016, 2018 IBM Corp. and others
# Copyright (c) 2016, 2019 IBM Corp. and others
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -68,7 +68,7 @@ autoconfig:

autogen: autoconfig
cd $(CURRENT_DIR)$(D)scripts$(D)testKitGen; \
perl testKitGen.pl --graphSpecs=$(SPEC) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --buildList=${BUILD_LIST} --iterations=$(TEST_ITERATIONS) $(OPTS); \
perl testKitGen.pl --graphSpecs=$(SPEC) --jdkVersion=$(JDK_VERSION) --impl=$(JDK_IMPL) --buildList=${BUILD_LIST} --iterations=$(TEST_ITERATIONS) --testFlag=$(TEST_FLAG) $(OPTS); \
cd $(CURRENT_DIR);

AUTOGEN_FILES = $(wildcard $(CURRENT_DIR)$(D)jvmTest.mk)
Expand Down
38 changes: 34 additions & 4 deletions test/TestConfig/scripts/testKitGen/makeGenTool/mkgen.pl
Expand Up @@ -51,9 +51,10 @@
my %targetGroup = ();
my $buildList = '';
my $iterations = 1;
my $testFlag = '';

sub runmkgen {
( $projectRootDir, $allLevels, $allGroups, $output, $graphSpecs, $jdkVersion, $allImpls, $impl, my $modesxml, my $ottawacsv, $buildList, $iterations ) = @_;
( $projectRootDir, $allLevels, $allGroups, $output, $graphSpecs, $jdkVersion, $allImpls, $impl, my $modesxml, my $ottawacsv, $buildList, $iterations, $testFlag ) = @_;

$testRoot = $projectRootDir;
if ($output) {
Expand Down Expand Up @@ -316,6 +317,24 @@ sub parseXML {
next;
}


if ( $testFlag =~ /AOT/ ) {
my $aotTag = getElementByTag( $testlines, 'aot' );
if ( !$aotTag ) {
# default to aot applicable
$test{'aot'} = 'applicable';
} elsif ( $aotTag eq 'nonapplicable' ) {
# Do not generate make taget if the test is aot not applicable when test flag is set to AOT.
next;
} elsif ( $aotTag eq 'applicable' ) {
$test{'aot'} = 'applicable';
} elsif ( $aotTag eq 'explicit' ) {
$test{'aot'} = 'explicit';
} else {
die "The aot tag: " . $aotTag . " for test " . $test{'testCaseName'} . " is not valid, the valid subset strings are nonapplicable, applicable and explicit.";
}
}

push( @tests, \%test );
}
}
Expand Down Expand Up @@ -415,10 +434,21 @@ sub writeTargets {
my $jvmtestroot = "\$(JVM_TEST_ROOT)\$(D)" . join("\$(D)", @{$currentdirs});
print $fhOut "$name: TEST_RESROOT=$jvmtestroot\n";

my $aotOptions = '';
# AOT_OPTIONS only needs to be apended when TEST_FLAG contains AOT and the test is aot applicable.
if ( defined $test->{'aot'} ) {
if ( $test->{'aot'} eq 'applicable' ) {
$aotOptions = '$(AOT_OPTIONS) ';
} elsif ( $test->{'aot'} eq 'explicit' ) {
# When test tagged with aot explicit, its test command has aot options and runs multiple times explictly.
$iterations = 1;
}
}

if ($jvmoptions) {
print $fhOut "$name: JVM_OPTIONS?=\$(AOT_OPTIONS) \$(RESERVED_OPTIONS) $jvmoptions \$(EXTRA_OPTIONS)\n";
print $fhOut "$name: JVM_OPTIONS?=$aotOptions\$(RESERVED_OPTIONS) $jvmoptions \$(EXTRA_OPTIONS)\n";
} else {
print $fhOut "$name: JVM_OPTIONS?=\$(AOT_OPTIONS) \$(RESERVED_OPTIONS) \$(EXTRA_OPTIONS)\n";
print $fhOut "$name: JVM_OPTIONS?=$aotOptions\$(RESERVED_OPTIONS) \$(EXTRA_OPTIONS)\n";
}

my $levelStr = '';
Expand Down Expand Up @@ -461,7 +491,7 @@ sub writeTargets {
print $fhOut "itercnt=$i; \\\n$indent\$(MKTREE) \$(REPORTDIR); \\\n$indent\$(CD) \$(REPORTDIR); \\\n";
print $fhOut "$indent$command;";
if ($i ne $iterations) {
print $fhOut " \\\n";
print $fhOut " \\\n$indent";
}
}
print $fhOut " \} 2>&1 | tee -a \$(Q)\$(TESTOUTPUT)\$(D)TestTargetResult\$(Q);\n";
Expand Down
9 changes: 7 additions & 2 deletions test/TestConfig/scripts/testKitGen/testKitGen.pl
Expand Up @@ -40,6 +40,7 @@
my $output = '';
my $buildList = '';
my $iterations = 1;
my $testFlag = '';
my @allLevels = ( "sanity", "extended", "special" );
my @allGroups = ( "functional", "openjdk", "external", "perf", "jck", "system" );
my @allImpls = ( "openj9", "ibm", "hotspot", "sap" );
Expand All @@ -63,6 +64,8 @@
$buildList = $1;
} elsif ( $argv =~ /^--iterations=(.*)/ ) {
$iterations = $1;
} elsif ( $argv =~ /^--testFlag=(.*)/ ) {
$testFlag = $1;
} else {
print "This program will search projectRootDir provided and find/parse playlist.xml to generate\n"
. "makefile (per project)\n"
Expand All @@ -83,7 +86,8 @@
. " If the ottawaCsv is not provided, the program will try to find ottawa.csv under projectRootDir/TestConfig/resources.\n"
. " --buildList=<paths> Comma separated project paths to search playlist.xml. The paths are relative to projectRootDir.\n"
. " If the buildList is not provided, the program will search all files under projectRootDir.\n"
. " --iterations=<number> Repeatedly generate test command based on iteration number. The default value is 1.\n";
. " --iterations=<number> Repeatedly generate test command based on iteration number. The default value is 1.\n"
. " --testFlag=<string> Comma separated string to specify different test flag. The default is empty.\n";
die "Please specify valid options!";
}
}
Expand All @@ -110,6 +114,7 @@
}

# run make file generator
runmkgen( $projectRootDir, \@allLevels, \@allGroups, $output, $graphSpecs, $jdkVersion, \@allImpls, $impl, $modesxml, $ottawacsv, $buildList, $iterations );

runmkgen( $projectRootDir, \@allLevels, \@allGroups, $output, $graphSpecs, $jdkVersion, \@allImpls, $impl, $modesxml, $ottawacsv, $buildList, $iterations, $testFlag );

print "\nTEST AUTO GEN SUCCESSFUL\n";

0 comments on commit b167041

Please sign in to comment.