Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Sophia Guo <[email protected]>
  • Loading branch information
sophia-guo committed Dec 8, 2023
1 parent fb22bbb commit a5690ff
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 37 deletions.
29 changes: 15 additions & 14 deletions test/functional/reproducibleCompare/linux_repro_build_compare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ checkAllVariablesSet() {
}

originalJDKDir=""
testDir="$PWD"
ls /home/jenkins/jdkbinary
workDir="$PWD"

if [ $# -lt 1 ]; then
if [ -d "/home/jenkins/jdkbinary" ]; then
find /home/jenkins/jdkbinary -type f -name '*sbom*.json' -exec cp {} "${testDir}" \;
find /home/jenkins/jdkbinary -type f -name '*sbom*.json' -exec cp {} "${workDir}" \;
SBOM=$(find /home/jenkins/jdkbinary -type f -name '*sbom*.json' -exec basename {} \;)
echo "SBOM is ${SBOM}"
else
Expand All @@ -107,7 +107,6 @@ LOCALGCCDIR=/usr/local/gcc$(echo "$GCCVERSION" | cut -d. -f1)
TEMURIN_BUILD_SHA=$(jq -r '.components[] | .properties[] | select (.name == "Temurin Build Ref") | .value' "$SBOM" | awk -F/ '{print $NF}')
TEMURIN_BUILD_ARGS=$(jq -r '.components[] | .properties[] | select (.name == "makejdk_any_platform_args") | .value' "$SBOM" | cut -d\" -f4 | sed -e "s/--disable-warnings-as-errors --enable-dtrace --without-version-pre --without-version-opt/'--disable-warnings-as-errors --enable-dtrace --without-version-pre --without-version-opt'/" -e "s/ --disable-warnings-as-errors --enable-dtrace/ '--disable-warnings-as-errors --enable-dtrace'/" -e 's/\\n//g' -e "s,--jdk-boot-dir [^ ]*,--jdk-boot-dir /usr/lib/jvm/jdk-$BOOTJDK_VERSION,g")
TEMURIN_VERSION=$(jq -r '.metadata.component.version' "$SBOM" | sed 's/-beta//' | cut -f1 -d"-")

NATIVE_API_ARCH=$(uname -m)
if [ "${NATIVE_API_ARCH}" = "x86_64" ]; then NATIVE_API_ARCH=x64; fi
if [ "${NATIVE_API_ARCH}" = "armv7l" ]; then NATIVE_API_ARCH=arm; fi
Expand All @@ -118,13 +117,13 @@ downloadTooling
setEnvironment

if [ $# -lt 1 ]; then
javacPath=$(find /home/jenkins/jdkbinary -name javac | egrep 'bin/javac$')
javacPath=$(find /home/jenkins/jdkbinary -name javac | grep -E 'bin/javac$')
if [ "$javacPath" != "" ]; then
originalJDKDir=$(dirname ${javacPath})/../
originalJDKDir=$(dirname "${javacPath}")/../
fi
fi

if [ ! -n originalJDKDir ] && [ ! -d "jdk-${TEMURIN_VERSION}" ]; then
if [ ! -n "${originalJDKDir}" ] && [ ! -d "jdk-${TEMURIN_VERSION}" ]; then
if [ -z "$TARBALL_URL" ]; then
TARBALL_URL="https://api.adoptium.net/v3/binary/version/jdk-${TEMURIN_VERSION}/linux/${NATIVE_API_ARCH}/jdk/hotspot/normal/eclipse?project=jdk"
fi
Expand All @@ -137,16 +136,18 @@ echo " cd temurin-build && ./makejdk-any-platform.sh $TEMURIN_BUILD_ARGS 2>&1 |
echo Comparing ...
mkdir compare.$$
tar xpfz temurin-build/workspace/target/OpenJDK*-jdk_*tar.gz -C compare.$$
ls -l compare.$$/jdk-$TEMURIN_VERSION/NOTICE
cleanBuildInfo

rc=0
# shellcheck disable=SC2069
if diff -r "${originalJDKDir}" "compare.$$/jdk-$TEMURIN_VERSION" 2>&1 > "reprotest.$(uname).$TEMURIN_VERSION.diff"; then
echo "Compare identical !"
exit 0
diff -r "${originalJDKDir}" "compare.$$/jdk-$TEMURIN_VERSION" 2>&1 > "reprotest.$(uname).$TEMURIN_VERSION.diff" || rc=$?

if [ $rc != 0 ]; then
cat "reprotest.$(uname).$TEMURIN_VERSION.diff"
echo "Differences found..., logged in: reprotest.$(uname).$TEMURIN_VERSION.diff"
else
cat "reprotest.$(uname).$TEMURIN_VERSION.diff"
echo "Differences found..., logged in: reprotest.$(uname).$TEMURIN_VERSION.diff"
exit 1
echo "Compare identical !"
fi

cp reprotest.$(uname).${TEMURIN_VERSION}.diff reprotest.diff
exit $rc
8 changes: 4 additions & 4 deletions test/functional/reproducibleCompare/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<playlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../TKG/playlist.xsd">
<test>
<testCaseName>Reproducible_Comparison</testCaseName>
<command>docker run -v "$(TEST_RESROOT):/home/jenkins/test" -v "$(TEST_JDK_HOME)/..:/home/jenkins/jdkbinary" -w "/home/jenkins/test" --name reproducibleCompare adoptopenjdk/centos7_build_image /bin/bash test.sh; \
<command>docker run -v "$(TEST_RESROOT):/home/jenkins/test" -v "$(TEST_JDK_HOME)/..:/home/jenkins/jdkbinary" -w "/home/jenkins/" --name reproducibleCompare adoptopenjdk/centos7_build_image /bin/bash /home/jenkins/test/linux_repro_build_compare.sh; \
$(TEST_STATUS); \
docker cp reproducibleCompare:/home/jenkins/test/reprotest.1.diff ./;
ls -l
docker cp reproducibleCompare:/home/jenkins/reprotest.diff ./; \
docker container rm reproducibleCompare
</command>
<levels>
<level>extended</level>
<level>dev</level>
</levels>
<groups>
<group>functional</group>
Expand Down
19 changes: 0 additions & 19 deletions test/functional/reproducibleCompare/test.sh

This file was deleted.

0 comments on commit a5690ff

Please sign in to comment.