Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functionality for testScript.sh to run a test on a built JDK #943

Merged
merged 1 commit into from
Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ansible/pbTestScripts/testJDK.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

mv /vagrant/pbTestScripts/workspace/build/src/build/linux-x86_64-normal-server-release/images/jdk8* ~
export TEST_JDK_HOME=$(find ~ -maxdepth 1 -type d -name "*jdk8u*"|grep -v ".*jre.*")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to just set TEST_JDK_HOME to /vagrant/pbTestScripts/workspace/build/src/build/linux-x86_64-normal-server-release/images/jdk8*?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's 2 directories in there- the JDK to test, and the JRE, which has the same name but -jre at the end

cd $HOME && mkdir -p testLocation
cd testLocation && git clone https://github.com/adoptopenjdk/openjdk-tests
cd openjdk-tests
./get.sh -t $HOME/testLocation/openjdk-tests
cd TestConfig
make -f run_configure.mk
export BUILD_LIST=MachineInfo
make compile
make _MachineInfo

15 changes: 13 additions & 2 deletions ansible/pbTestScripts/testScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gitURL=''
vagrantOS=''
retainVM=false
testNativeBuild=false
runTest=false

# Takes all arguments from the script, and determines options
processArgs()
Expand All @@ -25,6 +26,8 @@ processArgs()
retainVM=true;;
"--URL" | "-u" )
gitURL="$1"; shift;;
"--test" | "-t" )
runTest=true;;
"--help" | "-h" )
usage; exit 0;;
*) echo >&2 "Invalid option: ${opt}"; echo "This option was unrecognised."; usage; exit 1;;
Expand All @@ -40,11 +43,16 @@ usage()
--retainVM | -r Option to retain the VM once building them
--build | -b Option to enable testing a native build on the VM
--URL | -u <GitURL> The URL of the git repository
--test | -t Runs a quick test on the built JDK
--help | -h Displays this help message"
}

defaultVars()
checkVars()
{
if [[ "$runTest" == true && "$testNativeBuild" == false ]]; then
echo "Unable to test an unbuilt JDK. Please specify both '--build' and '--test'"
exit 1
fi
#Sets WORKSPACE to home if WORKSPACE is empty or undefined.
if [ ! -n "${WORKSPACE:-}" ]; then
echo "WORKSPACE not found, setting it as environment variable 'HOME'"
Expand Down Expand Up @@ -148,6 +156,9 @@ startVMPlaybook()
vagrant ssh -c "cd /vagrant/playbooks/AdoptOpenJDK_Unix_Playbook && sudo ansible-playbook --skip-tags adoptopenjdk,jenkins main.yml" 2>&1 | tee ~/adoptopenjdkPBTests/logFiles/$folderName.$branchName.$OS.log
if [[ "$testNativeBuild" = true ]]; then
testBuild
if [[ "$runTest" = true ]]; then
vagrant ssh -c "cd /vagrant/pbTestScripts && ./testJDK.sh"
fi
fi
vagrant halt
}
Expand Down Expand Up @@ -223,7 +234,7 @@ splitURL()
}
# var1 = GitURL, var2 = y/n for VM retention
processArgs $*
defaultVars
checkVars
splitURL
checkVagrantOS
setupFiles
Expand Down