Skip to content

Start/stop agent with every vm/jdwp test #6044

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

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
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
53 changes: 53 additions & 0 deletions jck/jck-jdwp-test-drive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

jckAgentPID=0
harnessExitCode=0
jckHarnessPID=0

startJCKAgent() {
echo "Starting JCK agent.."
eval "$1"
jckAgentPID=$!
echo "Agent started with PID $jckAgentPID"
}

stopJCKAgent() {
echo "Test complete. Stopping JCK Agent.."
kill -9 $jckAgentPID
}

startJCKHarness() {
echo "Starting JCK harness.."
eval "$1"
jckHarnessPID=$!
}

queryVmJdwpTest() {
local jck_root_path="$1/JCK-runtime-$2/"
eval "$3/bin/java -cp $jck_root_path/lib/javatest.jar com.sun.javatest.finder.ShowTests -finder com.sun.javatest.finder.HTMLTestFinder -end $jck_root_path/tests/testsuite.html -initial vm/jdwp | tr -d "[:blank:]""
}


# Query all of the tests in $(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_NUMBER)/tests/vm/jdwp/
queryVmJdwpTest "$6" "$7" "$8" | while read -r test;
do
cp "$3" temp_jdwp.jtb
# Replace tests=vm/jdwp line with tests=<Individual test case>
sed -i -e "s/tests vm/jdwp/tests $test/g" temp_jdwp.jtb
startJCKAgent "$1"
# $(TEST_STATUS) and $(GEN_SUMMARY_GENERIC) are passed into startJCKHarness
# startJCKHarness "$2" temp_jdwp.jtb "$4" "$5" tests=$test testsuite=RUNTIME
startJCKHarness "$2" temp_jdwp.jtb tests=$test testsuite=RUNTIME
sleep 60 # 60 second timeout
if kill -s 0 $jckHarnessPID 2>nul; then
echo "Testcase $test : Process $jckHarnessPID is still running after 60 seconds... killing..."
kill -9 $jckHarnessPID
harnessExitCode=124
else
wait $jckHarnessPID
harnessExitCode=$?
fi
stopJCKAgent
done

exit $harnessExitCode
3 changes: 3 additions & 0 deletions jck/jck.mk
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ else
endif

$(shell chmod +x $(TEST_ROOT)$(D)jck$(D)agent-drive.sh)
$(shell chmod +x $(TEST_ROOT)$(D)jck$(D)jck-jdwp-test-drive.sh)

START_MULTI_JVM_COMP_TEST = $(TEST_ROOT)$(D)jck$(D)agent-drive.sh '$(START_AGENT)' '$(START_HARNESS)'
GEN_JTB_GENERIC = $(JAVA_TO_TEST) -Djvm.options=$(Q)$(JVM_OPTIONS)$(Q) -Dother.opts=$(Q)$(OTHER_OPTS)$(Q) -cp $(TEST_ROOT)/jck/jtrunner/bin JavatestUtil testRoot=$(TEST_ROOT) jckRoot=$(JCK_ROOT) jckversion=$(JCK_VERSION) workdir=$(REPORTDIR) configAltPath=$(CONFIG_ALT_PATH) testJava=$(JAVA_TO_TEST) riJava=$(JAVA_TO_TEST) task=cmdfilegen spec=$(SPEC) $(APPLICATION_OPTIONS)
Expand All @@ -171,9 +172,11 @@ START_RMIREG = $(TEST_JDK_HOME)/bin/rmiregistry > $(REPORTDIR)$(D)rmiregistry.lo
START_RMID = $(TEST_JDK_HOME)/bin/rmid -J-Dsun.rmi.activation.execPolicy=none -J-Djava.security.policy=$(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_NUMBER)/lib/jck.policy > $(REPORTDIR)$(D)rmid.log &
START_TNAMESRV = $(TEST_JDK_HOME)/bin/tnameserv -ORBInitialPort 9876 > $(REPORTDIR)$(D)tnameserv.log &
EXEC_RUNTIME_TEST = $(JAVA_TO_TEST) -jar $(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_NUMBER)/lib/javatest.jar -config $(CONFIG_ALT_PATH)/$(JCK_VERSION)/runtime.jti @$(REPORTDIR)/generated.jtb
EXEC_RUNTIME_TEST_NO_JTB = $(JAVA_TO_TEST) -jar $(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_NUMBER)/lib/javatest.jar -config $(CONFIG_ALT_PATH)/$(JCK_VERSION)/runtime.jti
EXEC_COMPILER_TEST = $(JAVA_TO_TEST) -jar $(JCK_ROOT)/JCK-compiler-$(JCK_VERSION_NUMBER)/lib/javatest.jar -config $(CONFIG_ALT_PATH)/$(JCK_VERSION)/compiler.jti @$(REPORTDIR)/generated.jtb
EXEC_DEVTOOLS_TEST = $(JAVA_TO_TEST) -jar $(JCK_ROOT)/JCK-devtools-$(JCK_VERSION_NUMBER)/lib/javatest.jar -config $(CONFIG_ALT_PATH)/$(JCK_VERSION)/devtools.jti @$(REPORTDIR)/generated.jtb
EXEC_RUNTIME_TEST_WITH_AGENT = $(TEST_ROOT)/jck/agent-drive.sh '$(START_AGENT_GENERIC)' '$(EXEC_RUNTIME_TEST)'
EXEC_RUNTIME_TEST_JDWP = $(TEST_ROOT)/jck/jck-jdwp-test-drive.sh '$(START_AGENT_GENERIC)' '$(EXEC_RUNTIME_TEST_NO_JTB)' @$(REPORTDIR)/generated.jtb $(JCK_ROOT) $(JCK_VERSION_NUMBER) $(TEST_JDK_HOME)
EXEC_RUNTIME_TEST_WITH_RMI_SERVICES = $(EXEC_RUNTIME_TEST_WITH_AGENT)

ifeq ($(JDK_VERSION), 8)
Expand Down
37 changes: 36 additions & 1 deletion jck/runtime.vm/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@
<group>jck</group>
</groups>
</test>
<test>
<testCaseName>jck-runtime-vm-jdwp-jdk-8-11</testCaseName>
<disables>
<disable>
<comment>backlog/issues/477</comment>
<impl>ibm</impl>
</disable>
<disable>
<comment>backlog/issues/477</comment>
<impl>openj9</impl>
</disable>
</disables>
<variations>
<variation>NoOptions</variation>
</variations>
<command>$(GEN_JTB_GENERIC) tests=vm/jdwp testsuite=RUNTIME concurrency=1; \
$(EXEC_RUNTIME_TEST_JDWP) ; \
<!-- Putting these back for now to test where the failure is -->
$(TEST_STATUS) ; \
$(GEN_SUMMARY_GENERIC) tests=vm/jdwp testsuite=RUNTIME
</command>
<levels>
<level>sanity</level>
</levels>
<groups>
<group>jck</group>
</groups>
<!-- <versions>
<version>8</version>
<version>11</version>
</versions> -->
</test>
<test>
<testCaseName>jck-runtime-vm-jdwp</testCaseName>
<disables>
Expand All @@ -54,7 +86,7 @@
<variations>
<variation>NoOptions</variation>
</variations>
<command>$(GEN_JTB_GENERIC) tests=vm/jdwp testsuite=RUNTIME concurrency=1; \
<command>$(GEN_JTB_GENERIC) tests=vm/jdwp testsuite=RUNTIME concurrency=1; \
$(EXEC_RUNTIME_TEST_WITH_AGENT); \
$(TEST_STATUS) ; \
$(GEN_SUMMARY_GENERIC) tests=vm/jdwp testsuite=RUNTIME
Expand All @@ -65,6 +97,9 @@
<groups>
<group>jck</group>
</groups>
<versions>
<version>17+</version>
</versions>
</test>
<test>
<testCaseName>jck-runtime-vm-jvmti</testCaseName>
Expand Down