diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 06895c9ad7ea..3721581b1186 100755 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -626,6 +626,14 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): java.run_java17('./gradlew --no-daemon jar -Dversion.release=%s' % version, '%s/compile.log' % unpackPath) testDemo(java.run_java17, isSrc, version, '17') + if java.run_alt_javas: + for run_alt_java in java.run_alt_javas: + print(" run tests w/ Java ?? and testArgs='%s'..." % testArgs) + run_alt_java('./gradlew --no-daemon test %s' % testArgs, '%s/test.log' % unpackPath) + print(" compile jars w/ Java ??") + run_alt_java('./gradlew --no-daemon jar -Dversion.release=%s' % version, '%s/compile.log' % unpackPath) + testDemo(run_alt_java, isSrc, version, '??') + print(' confirm all releases have coverage in TestBackwardsCompatibility') confirmAllReleasesAreTestedForBackCompat(version, unpackPath) @@ -636,6 +644,9 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): testDemo(java.run_java11, isSrc, version, '11') if java.run_java17: testDemo(java.run_java17, isSrc, version, '17') + if java.run_alt_javas: + for run_alt_java in java.run_alt_javas: + testDemo(run_alt_java, isSrc, version, '??') testChangesText('.', version) @@ -911,7 +922,7 @@ def crawl(downloadedFiles, urlString, targetDir, exclusions=set()): sys.stdout.write('.') -def make_java_config(parser, java17_home): +def make_java_config(parser, java17_home, alt_java_homes): def _make_runner(java_home, version): print('Java %s JAVA_HOME=%s' % (version, java_home)) if cygwin: @@ -920,11 +931,15 @@ def _make_runner(java_home, version): (java_home, java_home, java_home) s = subprocess.check_output('%s; java -version' % cmd_prefix, shell=True, stderr=subprocess.STDOUT).decode('utf-8') - if s.find(' version "%s' % version) == -1: + # TODO: Print actual version when provided version is None + if version is not None and s.find(' version "%s' % version) == -1: parser.error('got wrong version for java %s:\n%s' % (version, s)) + def run_java(cmd, logfile): run('%s; %s' % (cmd_prefix, cmd), logfile) + return run_java + java11_home = os.environ.get('JAVA_HOME') if java11_home is None: parser.error('JAVA_HOME must be set') @@ -932,12 +947,18 @@ def run_java(cmd, logfile): run_java17 = None if java17_home is not None: run_java17 = _make_runner(java17_home, '17') + run_alt_javas = [] + if alt_java_homes: + for alt_java_home in alt_java_homes: + run_alt_java = _make_runner(alt_java_home, None) + run_alt_javas.append(run_alt_java) - jc = namedtuple('JavaConfig', 'run_java11 java11_home run_java17 java17_home') - return jc(run_java11, java11_home, run_java17, java17_home) + jc = namedtuple('JavaConfig', 'run_java11 java11_home run_java17 java17_home run_alt_javas alt_java_homes') + return jc(run_java11, java11_home, run_java17, java17_home, run_alt_javas, alt_java_homes) version_re = re.compile(r'(\d+\.\d+\.\d+(-ALPHA|-BETA)?)') revision_re = re.compile(r'rev-([a-f\d]+)') + def parse_config(): epilogue = textwrap.dedent(''' Example usage: @@ -958,6 +979,8 @@ def parse_config(): help='Version of the release, defaults to that in URL') parser.add_argument('--test-java17', metavar='java17_home', help='Path to Java17 home directory, to run tests with if specified') + parser.add_argument('--test-alternative-java', action='append', + help='Path to alternative Java home directory, to run tests with if specified') parser.add_argument('--download-only', action='store_true', default=False, help='Only perform download and sha hash check steps') parser.add_argument('url', help='Url pointing to release to test') @@ -984,7 +1007,7 @@ def parse_config(): if c.local_keys is not None and not os.path.exists(c.local_keys): parser.error('Local KEYS file "%s" not found' % c.local_keys) - c.java = make_java_config(parser, c.test_java17) + c.java = make_java_config(parser, c.test_java17, c.test_alternative_java) if c.tmp_dir: c.tmp_dir = os.path.abspath(c.tmp_dir)