As a correction to my earlier suggestion, I note that $JAVA_HOME should
really be $TESTJAVA, or else something like
${TESTJAVA:-${JAVA_HOME}}
to get the best of both worlds.
But, to generalize summarize this thread, I think we're seeing ways to
move forward without any additional changes to jtreg.
-- Jon
On 1/23/19 3:25 PM, Jonathan Gibbons wrote:
On 1/23/19 1:56 PM, Jonathan Gibbons wrote:
On 1/23/19 1:49 PM, Jonathan Gibbons wrote:
On 1/23/19 1:12 PM, Alexandre (Shura) Iline wrote:
I think it is only natural to expect folks to debug shell tests
directly. If we accept this assumption, then, is there any
reasonable alternative to “uname"? There is a “systeminfo” tool on
windows, not sure if it helps. We really need to know what “uname
-s” outputs, though, as it might still work.
It would help if we could crowd-source a table showing the value on
different systems.
-- jon
... but that being said, `uname` will test the system being used to
run the shell script; it seems we need to distinguish the different
kinds of JDK we might be wanting to test ... i.e is the JDK a "Linux
JDK" or a "WIndows JDK". You won't get that from `uname`, since (as I
understand it) the WSL world can invoke either sort of JDK.
This seems to be the thinking behind Andrew's suggestion of providing
WSL_TARGET, but it just seems weird, in his proposed text, to be
testing WSL_TARGET when we might not be running on WSL.
-- Jon
Here's a variant of Andrew's earlier suggestion that does not require
jtreg setting either EXE_SUFFIX or WSL_TARGET, which is nice because
that supports standalone invocation of the shell script for
development and debugging.
OS=`uname -s`;
case "$OS" in
Windows* | CYGWIN* )
FS="\\"
PS=";"
;;
Linux )
if [ -r $JAVA_HOME/bin/java.exe ]; then
FS="\\"
PS=";"
EXE_SUFFIX=".exe"
else
FS="/"
PS=":"
fi
;;
* )
FS="/"
PS=":"
esac
Note: that code is not tested on any platforms, and may need to be
adapted as needed in some tests .. e.g. some tests want SEP instead of
PS, some tests may also want NULL (set to NUL or /dev/null), etc
Yes, the code fragment is growing, but Shura points out that if enough
tests would make use of it, we could put a script in a shared test
library somewhere, to reduce the impact in any individual test.
-- Jon