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

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

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

jckAgentPID=0
harnessExitCode=0
tnameservPID=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
}

startTNameServ() {
echo "Starting TNAMESERV.."
eval $1
tnameservPID=$!
echo "TNAMESERV started with PID $tnameservPID"
}

startJCKHarness() {
echo "Starting JCK harness.."
eval $1; return $?
}

stopTNameServ() {
echo "Stopping TNAMESERV.."
kill -9 $tnameservPID
}

# Query all of the tests in $(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_NUMBER)/tests/vm/jdwp/
find $4 -type f -name "*.java" | while read -r test;
do
startJCKAgent
# cp generated.jtb temp_jdwp.jtb
# Replace tests=vm/jdwp line with tests=<TEST_CASE>
# Not sure what to do here ^^
Copy link
Contributor

Choose a reason for hiding this comment

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

EXEC_RUNTIME_TEST will contain @$(REPORTDIR)/generated.jtb
you will need to probably use a new EXEC_RUNTIME_TEST_JDWP that does not have @$(REPORTDIR)/generated.jtb, and pass the generated.jtb as another param to this script... then use that as the basis of the cp generated.jtb...
then add the temp.jtb to the end of each EXEC... ie.

startJCKHarness "$2" @temp.jtb

startTNameServ "$2"
startJCKHarness "$3"
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to have a hard process timeout on the testcase run in case it hangs... as we know the jtharness does not time it out...
Try adding logic like this, note needs to work for all platforms... :

${startJCKHarness} &
pid=$!
sleep 60 # 60 second timeout
if kill -s 0 $pid 2>nul; then
    echo "Testcase ?? : Process $pid is still running after 60 seconds... killing..."
    kill -9 $pid
    harnessExitCode=124
else
    wait $pid
    harnessExitCode=$?
fi

Copy link
Contributor

Choose a reason for hiding this comment

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

Also you will need to keep the worst harnessExitCode, to exit the whole jdwp loop with a non-0 rc if one or more fails...

harnessExitCode=$?
Copy link
Contributor

@andrew-m-leonard andrew-m-leonard Mar 13, 2025

Choose a reason for hiding this comment

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

Also another complication, we need to report the status report after each jdwp testcase otherwise it will be overwritten, we could try merging the report.xml's but not sure that will work...
So maybe easiest to simply report on each after each testcase, so i think we need this after each testcase:

$(TEST_STATUS) ; 
$(GEN_SUMMARY_GENERIC) tests=???? testsuite=RUNTIME

stopTNameServ
Copy link
Contributor

Choose a reason for hiding this comment

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

No need for start/stopTNameServ

stopJCKAgent
done
1 change: 1 addition & 0 deletions jck/jck.mk
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ EXEC_RUNTIME_TEST = $(JAVA_TO_TEST) -jar $(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_N
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)' '$(JCK_ROOT)/JCK-runtime-$(JCK_VERSION_NUMBER)/tests/vm/jdwp/'
Copy link
Contributor

Choose a reason for hiding this comment

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

Will need to separate @$(REPORTDIR)/generated.jtb from '$('$(EXEC_RUNTIME_TEST)')'
so create a new EXEC_RUNTIME_TEST_JDWP

EXEC_RUNTIME_TEST_WITH_RMI_SERVICES = $(EXEC_RUNTIME_TEST_WITH_AGENT)

ifeq ($(JDK_VERSION), 8)
Expand Down
2 changes: 1 addition & 1 deletion jck/runtime.vm/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<variation>NoOptions</variation>
</variations>
<command>$(GEN_JTB_GENERIC) tests=vm/jdwp testsuite=RUNTIME concurrency=1; \
$(EXEC_RUNTIME_TEST_WITH_AGENT); \
$(EXEC_RUNTIME_TEST_JDWP); \
$(TEST_STATUS) ; \
$(GEN_SUMMARY_GENERIC) tests=vm/jdwp testsuite=RUNTIME
</command>
Expand Down