Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a7a0423
Prototype 1
smlambert Mar 31, 2025
3f59e4a
Remove problematic echo
smlambert Mar 31, 2025
d8c6063
Disable jckinteractives_custom
smlambert Mar 31, 2025
10fbef4
Fix brackets
smlambert Mar 31, 2025
5cfd763
Improvements
smlambert Mar 31, 2025
56f7cb4
Debug
smlambert Apr 1, 2025
715085e
Debug
smlambert Apr 1, 2025
7658d82
Whitespace
smlambert Apr 1, 2025
c5bc2e7
Remove extra semicolon
smlambert Apr 1, 2025
c71f786
permissions
smlambert Apr 1, 2025
7d0d623
Update script
smlambert Apr 1, 2025
d070fba
Debug
smlambert Apr 1, 2025
c94b76d
Remove tar cmd
smlambert Apr 1, 2025
7de0328
Add player.properties
smlambert Apr 3, 2025
b99e652
new dir structure
smlambert Apr 3, 2025
556151d
Updates to playlist and runTests
smlambert Apr 4, 2025
41d11a9
Remove uneeded files
smlambert Jun 2, 2025
eb16def
Remove xvfb calls
smlambert Jun 2, 2025
b327450
Update target
smlambert Jun 2, 2025
abbbb49
Update arctic jar commands
smlambert Jun 2, 2025
ba4ac9c
Remove incorrect bracketing
smlambert Jun 2, 2025
1156451
Use OS_NAME
smlambert Jun 2, 2025
2ca4cbd
Back to PLATFORM
smlambert Jun 2, 2025
c1aaf2d
Different platforms have different JENKINS_HOME
smlambert Jun 2, 2025
25ca6ca
Loop thru test_dir
smlambert Jun 2, 2025
03708d0
Debug
smlambert Jun 2, 2025
ec1f7ed
Strip file and suffix off
smlambert Jun 2, 2025
cbac077
use basename
smlambert Jun 2, 2025
75a349b
Strip down to only file name
smlambert Jun 2, 2025
d454c4b
Get tcase name
smlambert Jun 2, 2025
ecc40b8
Extend sleep
smlambert Jun 4, 2025
dfd68ad
Cp and edit player.properties
smlambert Jun 11, 2025
23fef3d
Fix sed line
smlambert Jun 12, 2025
2acdb28
Fix quotes
smlambert Jun 12, 2025
f751a76
Debug
smlambert Jun 12, 2025
59b5381
Remove extraneous backslashes
smlambert Jun 12, 2025
5e6e8c3
Updates for scope
smlambert Jun 17, 2025
dabf623
Debugging
smlambert Jun 20, 2025
87b94e5
Debugging
smlambert Jun 23, 2025
002f609
Debug
smlambert Jun 24, 2025
fa2c7f7
Remove extra dir
smlambert Jun 24, 2025
c28b893
Debug
smlambert Jun 24, 2025
0694302
Debug
smlambert Jun 24, 2025
ae98351
Debug
smlambert Jun 24, 2025
b39455a
Update targets
smlambert Jun 25, 2025
e4d4ca8
Bash
smlambert Jun 25, 2025
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
288 changes: 288 additions & 0 deletions jck/interactives/arctic_tests/runTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
#!/usr/bin/env bash
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set +e

active_versions=("24" "21" "17" "11" "default")
SLEEP_TIME=5
export LC_ALL=POSIX

setupLinuxEnv() {
echo "Setup Linux Environment"
# Fetch the prebuilt arctic jar (will be pulled from prereq build eventually)
# wget -q https://ci.adoptium.net/job/Build_Arctic/5/artifact/upload/arctic-0.8.1.jar

# Set environment variables, makes the assumption that JDK21 is the default java in /usr/bin/java
export ARCTIC_JDK=/usr/bin/java

echo "Fonts:"
echo "==========================================="
find /usr/share/fonts -name "*" -type d
echo "==========================================="

cp /etc/X11/twm/system.twmrc $HOME/.twmrc
echo 'RightTitleButton "xlogo11" = f.delete' >> $HOME/.twmrc
echo 'Button3 = : root : f.menu "windowops"' >> $HOME/.twmrc
echo 'RandomPlacement' >> $HOME/.twmrc

# Ensure fonts match recording vs playback
sed -i 's/MenuFont.*$/MenuFont "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1"/g' $HOME/.twmrc
sed -i 's/TitleFont .*$/TitleFont "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1"/g' $HOME/.twmrc
sed -i 's/IconFont .*$/IconFont "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1"/g' $HOME/.twmrc
sed -i 's/ResizeFont .*$/ResizeFont "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1"/g' $HOME/.twmrc
sed -i 's/IconManagerFont .*$/IconManagerFont "-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1"/g' $HOME/.twmrc

# Ensure consistent colors
sed -i 's/BorderColor.*$/BorderColor "slategrey"/g' $HOME/.twmrc
sed -i 's/DefaultBackground.*$/DefaultBackground "rgb:2\\/a\\/9"/g' $HOME/.twmrc
sed -i 's/DefaultForeground.*$/DefaultForeground "gray85"/g' $HOME/.twmrc
sed -i 's/TitleBackground.*$/TitleBackground "rgb:2\\/a\\/9"/g' $HOME/.twmrc
sed -i 's/TitleForeground.*$/TitleForeground "gray85"/g' $HOME/.twmrc
sed -i 's/MenuBackground.*$/MenuBackground "rgb:2\\/a\\/9"/g' $HOME/.twmrc
sed -i 's/MenuForeground.*$/MenuForeground "gray85"/g' $HOME/.twmrc
sed -i 's/MenuBorderColor.*$/MenuBorderColor "slategrey"/g' $HOME/.twmrc
sed -i 's/MenuTitleBackground.*$/MenuTitleBackground "gray70"/g' $HOME/.twmrc
sed -i 's/MenuTitleForeground.*$/MenuTitleForeground "rgb:2\\/a\\/9"/g' $HOME/.twmrc
sed -i 's/IconBackground.*$/IconBackground "rgb:2\\/a\\/9"/g' $HOME/.twmrc
sed -i 's/IconForeground.*$/IconForeground "gray85"/g' $HOME/.twmrc
sed -i 's/IconBorderColor.*$/IconBorderColor "gray85"/g' $HOME/.twmrc
sed -i 's/IconManagerBackground.*$/IconManagerBackground "rgb:2\\/a\\/9"/g' $HOME/.twmrc
sed -i 's/IconManagerForeground.*$/IconManagerForeground "gray85"/g' $HOME/.twmrc

# Start twm
twm &
twm_pid=$!
echo "Started twm process $twm_pid"
}

setupMacEnv() {
export AWT_FORCE_HEADFUL=true
echo "Setup Mac Environment"
cat <<EOF > JMinWindows.java
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.awt.Desktop;
import java.io.File;
public class JMinWindows {
public static void main(String... args) throws Exception {
System.out.println("JMinWindows: Opening Finder on home folder so Finder becomes active front window and will get closed by Alt-Cmd-M");
Desktop.getDesktop().open(new File(System.getProperty("user.home")));
System.out.println("JMinWindows: Issuing Alt-Cmd-H to minimize all 'other' Windows");
Robot r = new Robot();
r.keyPress(KeyEvent.VK_META);
r.delay(250);
r.keyPress(KeyEvent.VK_ALT);
r.delay(250);
r.keyPress(KeyEvent.VK_H);
r.delay(250);
r.keyRelease(KeyEvent.VK_H);
r.delay(250);
r.keyRelease(KeyEvent.VK_ALT);
r.delay(250);
r.keyRelease(KeyEvent.VK_META);
r.delay(250);
System.out.println("JMinWindows: Issuing Alt-Cmd-M to minimize all Finder Windows");
r.keyPress(KeyEvent.VK_META);
r.delay(250);
r.keyPress(KeyEvent.VK_ALT);
r.delay(250);
r.keyPress(KeyEvent.VK_M);
r.delay(250);
r.keyRelease(KeyEvent.VK_M);
r.delay(250);
r.keyRelease(KeyEvent.VK_ALT);
r.delay(250);
r.keyRelease(KeyEvent.VK_META);
r.delay(250);
}
}
EOF

javac JMinWindows.java
java -Djava.awt.headless=false JMinWindows

echo "Running java ListJavaFonts..."

cat <<EOF > ListJavaFonts.java
import java.awt.GraphicsEnvironment;
public class ListJavaFonts {
public static void main( String[] args ) {
String java_fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
for(String font : java_fonts) System.out.println( font );
}
}
EOF

javac ListJavaFonts.java
echo "================================================"
java ListJavaFonts
echo "================================================"

}

setupWindowsEnv() {
echo "Setup Windows Environment"
ARCTIC_JDK=$(cygpath -u "C:/Users/jenkins/jck_run/${TEST_JDK_PATH}/bin/java")
echo "Copying Arctic.jar Into Place"
cp -rf /cygdrive/c/temp/arctic_jars/arctic-0.8.1.jar ${LIB_DIR}/arctic.jar
cp -rf /cygdrive/c/temp/arctic_jars/JNativeHook-0.8.1.x86_64.dll ${LIB_DIR}/JNativeHook-0.8.1.x86_64.dll
echo "Working directory: $(pwd)"
}

JOPTIONS="-Djava.net.preferIPv4Stack=true -Djdk.attach.allowAttachSelf=true -Dsun.rmi.activation.execPolicy=none -Djdk.xml.maxXMLNameLimit=4000"

if [ $(uname) = Linux ]; then
JENKINS_HOME=/home/jenkins
PPROP_LINE='s#arctic.common.repository.json.path.*$#arctic.common.repository.json.path = /home/jenkins/jck_run/arctic/linux/arctic_tests#g'
setupLinuxEnv

elif [ $(uname) = Darwin ]; then
JENKINS_HOME = "/Users/jenkins"
PPROP_LINE='s#arctic.common.repository.json.path.*\$#arctic.common.repository.json.path = /Users/jenkins/jck_run/arctic/mac/arctic_tests#g'
setupMacEnv

elif [ $(uname) = Windows_NT ]; then
JENKINS_HOME = "c:/Users/jenkins"
PPROP_LINE='s#arctic.common.repository.json.path.*$#arctic.common.repository.json.path = c:/Users/jenkins/jck_run/arctic/windows/arctic_tests#g'
setupWindowsEnv

fi

# Verify that the contents are present in jck_run
TEST_GROUP=$1
PLATFORM=$2
VERSION=$3
TEST_SUB_DIR=$4
JCK_VERSION_NUMBER=$5
OSNAME=${PLATFORM%_*}
STARTING_SCOPE=$VERSION
if [ $VERSION -eq 8 ]; then
STARTING_SCOPE="default"
fi

if [ $OSNAME = osx ]; then
$OSNAME = "mac"
fi

if [ $PLATFORM = "ppc64le_linux" ]; then
wget -q https://ci.adoptium.net/job/Build_Arctic_ppc64le_linux/lastSuccessfulBuild/artifact/upload/arctic-0.8.1.jar
elif [ $PLATFORM = "s390x_linux" ]; then
wget -q https://ci.adoptium.net/job/Build_Arctic_s390x_linux/lastSuccessfulBuild/artifact/upload/arctic-0.8.1.jar
else
wget -q https://ci.adoptium.net/job/Build_Arctic/lastSuccessfulBuild/artifact/upload/arctic-0.8.1.jar
fi

mv arctic-0.8.1.jar ${LIB_DIR}/arctic.jar

cp $JENKINS_HOME/jck_run/arctic/$OSNAME/player.properties .
echo "Player properties line is $PPROP_LINE"
sed -i "$PPROP_LINE" player.properties

if [ ! -f ${LIB_DIR}/arctic.jar ]; then
echo "arctic.jar not present"
ls -al ${LIB_DIR}
fi

echo "Starting player in background with RMI..."
# $ARCTIC_JDK -Darctic.logLevel=TRACE -jar ${LIB_DIR}/arctic.jar -p &
rc=$?
if [ $rc -ne 0 ]; then
echo "Unable to start Arctic player, rc=$rc"
exit $rc
fi

echo "Java under test: $TEST_JDK_HOME"
# twm &
TOP_DIR=$JENKINS_HOME/jck_run/arctic/$OSNAME/arctic_tests
TEST_DIR=$TOP_DIR/$STARTING_SCOPE/$TEST_SUB_DIR/interactive
echo "TEST_DIR is $TEST_DIR"
ls -al "$TEST_DIR"
echo "TEST_GROUP is $TEST_GROUP, OSNAME is $OSNAME, VERSION is $VERSION", STARTING_SCOPE is $STARTING_SCOPE, TEST_SUB_DIR is $TEST_SUB_DIR

# Loop through files in the target directory
for testcase in $TEST_DIR/*; do

for i in "${active_versions[@]}"; do
testcase=${testcase/"$STARTING_SCOPE"/"$i"}
echo "testcase is $testcase"
echo "Look for testcases in version: $i"
if [ ! -e $testcase ] || [ "$VERSION" -ge "$i" ]; then
continue
fi

if [ -d $testcase ]; then
echo "Starting testcase... $testcase"
tcase=${testcase##*/}
tcase=${tcase%.html}
echo "tcase is $tcase"
tgroup=${TEST_GROUP//_/\.}
echo "tgroup is $tgroup"

TESTCASE_ID="ALL"
ARCTIC_TESTCASE=$tcase
if [[ "$tcase" == "*.html" ]]; then
#TEST_HTML=S
elif [[ "$tcase" == "*.html/" ]]; then
#TEST_HTML=params.TESTCASE.substring(0, params.TESTCASE.indexOf(".html")+5)
#TESTCASE_ID=params.TESTCASE.substring(params.TESTCASE.indexOf(".html")+6)
#ARCTIC_TESTCASE=TEST_HTML+"/"+TESTCASE_ID
else
TEST_HTML=$tcase

# $TEST_JDK_HOME/bin/java --enable-preview --add-modules java.xml.crypto,java.sql $JOPTIONS -classpath :$JENKINS_HOME/jck_root/JCK$VERSION-unzipped/JCK-runtime-$JCK_VERSION_NUMBER/classes: -Djava.security.policy=$JENKINS_HOME/jck_root/JCK$VERSION-unzipped/JCK-runtime-$JCK_VERSION_NUMBER/lib/jck.policy javasoft.sqe.tests.api.$tgroup.interactive.$tcase -TestCaseID ${TESTCASE_ID} &

sleep $SLEEP_TIME
echo "Running testcase $testcase"
# $ARCTIC_JDK -jar ${LIB_DIR}/arctic.jar -c test start "api/$TEST_GROUP" "$tcase"
rc=$?

if [[ $rc -ne 0 ]]; then
echo "Unable to start playback for testcase $TEST_GROUP/$tcase, rc=$rc"
exit $rc
fi

sleep $SLEEP_TIME
echo "$TEST_GROUP/$tcase"
result="testing"
# result=$($ARCTIC_JDK -jar ${LIB_DIR}/arctic.jar -c test list $TEST_GROUP/$tcase)
rc=$?
status=$(echo $result | tr -s ' ' | cut -d' ' -f2)
echo "==>" $status
while [[ $rc -eq 0 ]] && { [[ "$status" == "RUNNING" ]] || [[ "$status" == "STARTING" ]]; }; do
sleep $SLEEP_TIME
result="testing"
# result=$($ARCTIC_JDK -jar ${LIB_DIR}/arctic.jar -c test list $TEST_GROUP/$tcase)
rc=$?
status=$(echo $result | tr -s ' ' | cut -d' ' -f2)
echo "==>" $status
done

echo "Terminating Arctic CLI..."
# $ARCTIC_JDK -jar ${LIB_DIR}/arctic.jar -c terminate
echo "Completed playback of $TEST_GROUP/$tcase status: ${status}"
fi

done

done

echo "Finished running $TEST_DIR testcases!"

if [[ $status != "UNCONFIRMED" ]]; then
echo "Arctic playback failed"
exit 1
else
echo "Arctic playback successful"
exit 0
fi
79 changes: 79 additions & 0 deletions jck/interactives/playlist.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../TKG/resources/playlist.xsd">
<include>../jck.mk</include>
<test>
<testCaseName>jckinteractives_custom</testCaseName>
<variations>
<variation>NoOptions</variation>
</variations>
<command>$(TEST_ROOT)$(D)jck$(D)interactives$(D)arctic_tests$(D)runTests.sh custom ${PLATFORM} ${JDK_VERSION} ${JCKINTERACTIVES_CUSTOM_TARGET} ${JCK_VERSION_NUMBER}; \
$(TEST_STATUS)
</command>
<disables>
<disable>
<comment>This test target is not yet available</comment>
</disable>
</disables>
<levels>
<level>dev</level>
</levels>
<groups>
<group>jck</group>
</groups>
</test>
<test>
<testCaseName>jckinteractives_java_awt</testCaseName>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should those two testcases be limited to linux, windows and mac only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They should be excluded on AIX and solaris, and I need to modify where the arctic.jar file is downloaded for the alternate Linux platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also these targets should not be triggered against 'headless' platforms.

<variations>
<variation>NoOptions</variation>
</variations>
<command>$(TEST_ROOT)$(D)jck$(D)interactives$(D)arctic_tests$(D)runTests.sh java_awt ${PLATFORM} ${JDK_VERSION} api/java/awt ${JCK_VERSION_NUMBER}; \
$(TEST_STATUS)
</command>
<disables>
<disable>
<comment>N/A for AIX and Solaris platforms</comment>
<platform>ppc64_aix|sparcv9_solaris|x86-64_solaris</platform>
</disable>
</disables>
<levels>
<level>dev</level>
</levels>
<groups>
<group>jck</group>
</groups>
</test>
<test>
<testCaseName>jckinteractives_javax_swing</testCaseName>
<variations>
<variation>NoOptions</variation>
</variations>
<command>$(TEST_ROOT)$(D)jck$(D)interactives$(D)arctic_tests$(D)runTests.sh javax_swing ${PLATFORM} ${JDK_VERSION} api/javax/swing ${JCK_VERSION_NUMBER}; \
$(TEST_STATUS)
</command>
<disables>
<disable>
<comment>N/A for AIX and Solaris platforms</comment>
<platform>ppc64_aix|sparcv9_solaris|x86-64_solaris</platform>
</disable>
</disables>
<levels>
<level>dev</level>
</levels>
<groups>
<group>jck</group>
</groups>
</test>
</playlist>
1 change: 1 addition & 0 deletions jck/jck.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
JCKRUNTIME_CUSTOM_TARGET ?= api/java_math/BigInteger
JCKCOMPILER_CUSTOM_TARGET ?= api/javax_lang/model/element/Element/index.html
JCKDEVTOOLS_CUSTOM_TARGET ?= java2schema/CustomizedMapping/classes/XmlRootElement/name/Name001.html
JCKINTERACTIVES_CUSTOM_TARGET ?= api/java_awt/interactive/ButtonTests.html

# Environment variable OSTYPE is set to cygwin if running under cygwin.
# Set our own macro to indicate we're running under cygwin.
Expand Down