Skip to content

Commit

Permalink
java6 compat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaosData committed Dec 12, 2021
1 parent c44d596 commit 105ba37
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/jnditest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ repositories {
dependencies {
implementation group: 'trust.nccgroup', name: 'log4j-jndi-be-gone', version: '1.0.0'

if (project.hasProperty('java6')) {
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.3'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.3'
} else {
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.1'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1'
}

testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.1'
testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1'
}

sourceSets {
Expand Down
22 changes: 22 additions & 0 deletions tests/jnditest/test-instrumented6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

SCRIPT="$0"
cd `dirname "${SCRIPT}"`
SCRIPT=`basename "${SCRIPT}"`

while [ -L "${SCRIPT}" ]
do
SCRIPT=`readlink "${SCRIPT}"`
cd `dirname "${SCRIPT}"`
SCRIPT=`basename "${SCRIPT}"`
done
SCRIPTDIR=`pwd -P`
cd "${SCRIPTDIR}"

cd ../../
./gradlew
cd "${SCRIPTDIR}"
./gradlew -Pjava6=true shadowJar testJar

docker run --read-only -it -v "${SCRIPTDIR}/build:/build:ro" openjdk:6-jdk \
java -javaagent:build/libs/jnditest-all.jar -jar build/libs/jnditest-tests.jar
22 changes: 22 additions & 0 deletions tests/jnditest/test-uninstrumented6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

SCRIPT="$0"
cd `dirname "${SCRIPT}"`
SCRIPT=`basename "${SCRIPT}"`

while [ -L "${SCRIPT}" ]
do
SCRIPT=`readlink "${SCRIPT}"`
cd `dirname "${SCRIPT}"`
SCRIPT=`basename "${SCRIPT}"`
done
SCRIPTDIR=`pwd -P`
cd "${SCRIPTDIR}"

cd ../../
./gradlew
cd "${SCRIPTDIR}"
./gradlew -Pjava6=true shadowJar testJar

docker run --read-only -it -v "${SCRIPTDIR}/build:/build:ro" openjdk:6-jdk \
java -jar build/libs/jnditest-tests.jar

0 comments on commit 105ba37

Please sign in to comment.