[jdk8u-dev] RFR: 8299804: Fix non-portable code in hotspot shell tests in 8u

zzambers duke at openjdk.org
Mon Jan 9 14:16:41 UTC 2023


Some hotspot shell tests use `==` for comparison inside of `[ ]`. However this is bash extension and it is not portable (posix test command only knows single `=`, see: [1]).

This results in errors on systems where default shell is not bash, such as Ubuntu used in GHA (which defaults to "Dash" shell). E.g.:
`Test7107135.sh: 50: [: x/bin/gcc: unexpected operator`
Expressions are then treated as always false.

Problem is only present on 8u as newer jdks use different approach for shell/jni tests and no longer have these shell tests.

Testing:
Tests passed in GHA, logs no longer contain these errors. (Affected tests passed even before, as problematic comparisons happen to have such form and placement, that they did not cause test failures, but logs contained error messages.)

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

-------------

Commit messages:
 - Fixed shell comparsions

Changes: https://git.openjdk.org/jdk8u-dev/pull/227/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk8u-dev&pr=227&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8299804
  Stats: 15 lines in 6 files changed: 0 ins; 0 del; 15 mod
  Patch: https://git.openjdk.org/jdk8u-dev/pull/227.diff
  Fetch: git fetch https://git.openjdk.org/jdk8u-dev pull/227/head:pull/227

PR: https://git.openjdk.org/jdk8u-dev/pull/227


More information about the jdk8u-dev mailing list