Forum Discussion

fixitdad's avatar
fixitdad
New Member
7 years ago

SOAPUI_HOME environment variable ignored on Linux

Posting here since I couldn't find a place to file a bug. I would submit a pull request, but the contributor agreement seems like to too much bother for this type of change. I don't really expect to be doing other contributions.

 

I'm using SoapUI-5.4.0 free edition on Centos 7.4 if anyone needs those details.

 

There appears to be a bug in several of the shell scripts that basically ignore the SOAPUI_HOME environment variable.

The script works if bash finds the script in the SoapUI bin directory. However, it does not work via a symbolic (or hard) link.

 

Here's the environment. The variable points to the installed SoapUI. There is a symbolic link to the script I'm running and the link is in the path prior to the SoapUI bin directory. (Could also leave out the SoapUI bin directory)

centos@icpclientaws ~]$ echo $SOAPUI_HOME
/home/centos/soapui/SoapUI-5.4.0
[centos@icpclientaws ~]$ ls $SOAPUI_HOME
JavaDoc.url RELEASENOTES.txt SmartBear License Terms of Use.txt jre licences uninstall
README.md SmartBear License Terms of Use.md bin lib soapUI.url wsi-test-tools
[centos@icpclientaws ~]$ ls -l ~/bin
total 0
lrwxrwxrwx. 1 centos centos 50 Apr 25 15:53 testrunner.sh -> /home/centos/soapui/SoapUI-5.4.0/bin/testrunner.sh
[centos@icpclientaws ~]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/centos/.local/bin:/home/centos/bin:/home/centos/soapui/SoapUI-5.4.0/bin

The script fails to execute:

[centos@icpclientaws ~]$ testrunner.sh
/home/centos/bin/testrunner.sh: line 42: java: command not found
================================
=
= SOAPUI_HOME = /home/centos
=
================================
/home/centos/bin/testrunner.sh: line 70: java: command not found

If I run testrunner.sh with shell debugging enabled, You can see SOAPUI_HOME is being overwritten with /home

 

[centos@icpclientaws ~]$ echo $SOAPUI_HOME
/home/centos/soapui/SoapUI-5.4.0

[centos@icpclientaws ~]$ sh -x testrunner.sh ++ dirname testrunner.sh + DIRNAME=. + cygwin=false + case "`uname`" in ++ uname + '[' -d /home/centos/soapui/SoapUI-5.4.0 ']' ++ cd ./.. ++ pwd + SOAPUI_HOME=/home + export SOAPUI_HOME + '[' -f /home/jre/bin/java ']' + '[' -f /home/../../PlugIns/jre.bundle/Contents/Home/jre/bin/java ']' + JAVA=java + SOAPUI_CLASSPATH='/home/bin/soapui-5.4.0.jar:/home/lib/*' ++ java -cp '/home/bin/soapui-5.4.0.jar:/home/lib/*' com.eviware.soapui.tools.JfxrtLocator /home/centos/soapui/SoapUI-5.4.0/bin/testrunner.sh: line 42: java: command not found + JFXRTPATH= + SOAPUI_CLASSPATH=':/home/bin/soapui-5.4.0.jar:/home/lib/*' + export SOAPUI_CLASSPATH + JAVA_OPTS='-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties -Dgroovy.source.encoding=iso-8859-1 -Dsoapui.home=/home/bin' + '[' /home '!=' '' ']' + JAVA_OPTS='-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties -Dgroovy.source.encoding=iso-8859-1 -Dsoapui.home=/home/bin -Dsoapui.ext.libraries=/home/bin/ext' + JAVA_OPTS='-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties -Dgroovy.source.encoding=iso-8859-1 -Dsoapui.home=/home/bin -Dsoapui.ext.libraries=/home/bin/ext -Dsoapui.ext.listeners=/home/bin/listeners' + JAVA_OPTS='-Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties -Dgroovy.source.encoding=iso-8859-1 -Dsoapui.home=/home/bin -Dsoapui.ext.libraries=/home/bin/ext -Dsoapui.ext.listeners=/home/bin/listeners -Dsoapui.ext.actions=/home/bin/actions' + export JAVA_OPTS + false + echo ================================ ================================ + echo = = + echo = SOAPUI_HOME = /home = SOAPUI_HOME = /home + echo = = + echo ================================ ================================ + java -Xms128m -Xmx1024m -Dsoapui.properties=soapui.properties -Dgroovy.source.encoding=iso-8859-1 -Dsoapui.home=/home/bin -Dsoapui.ext.libraries=/home/bin/ext -Dsoapui.ext.listeners=/home/bin/listeners -Dsoapui.ext.actions=/home/bin/actions -cp ':/home/bin/soapui-5.4.0.jar:/home/lib/*' com.eviware.soapui.tools.SoapUITestCaseRunner /home/centos/soapui/SoapUI-5.4.0/bin/testrunner.sh: line 70: java: command not found

I can fix the issue by modifying the following section of the script

# Setup SOAPUI_HOME
if [ -d $SOAPUI_HOME ]
then
    # get the full path (without any relative bits)
    SOAPUI_HOME=`cd $DIRNAME/..; pwd`
fi

Just change the if condition to the following (i.e. negate the condition).

if [ ! -d $SOAPUI_HOME ]

 

As written, the script is testing to see if there is a directory as SOAPUI_HOME and if there is, then it overwrites the SOAPUI_HOME variable (with garbage in my case). I doubt that this is the desired behavior. If it is, then I think some explaining comment would be in order.

 

The following other scripts are also affected:

loadtestrunner.sh

mockservicerunner.sh

toolrunner.sh

soapui.sh

 

I would appreciate it if someone could pass this along to the development team.

  • nmrao's avatar
    nmrao
    Champion Level 3
    I remember having an issue with SOAPUI_HOME environment variable on windows platform for the mentioned scripts, so time ago. But absolutely had no issue on linux platform.

    This is little annoying. But since you already know the workaround just use the changed files and share to your team. This changes are required when you are doing certain things based on those environment variable.

    Usually, there is no defect tracking system and here is the only place for reporting issues. Hope SmartBear team have an eve on the forum and address them.

    Thanks for reporting.