提交 33ee9da7 编写于 作者: oldratlee's avatar oldratlee 🔥

update scripts: test kotlin-support module

上级 3d99b109
...@@ -130,26 +130,41 @@ mvnCompileTest() { ...@@ -130,26 +130,41 @@ mvnCompileTest() {
fi fi
} }
readonly dependencies_dir="library/target/dependency" readonly core_module_dependencies_dir="library/target/dependency"
readonly kotlin_support_module_dependencies_dir="kotlin-support/target/dependency"
mvnCopyDependencies() { mvnCopyDependencies() {
if [ ! -e "$dependencies_dir" ]; then if [ ! -e "$core_module_dependencies_dir" ]; then
# https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html # https://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html
# exclude repackaged and shaded javassist libs # exclude repackaged and shaded javassist libs
runCmd "${MVN_CMD[@]}" dependency:copy-dependencies -DincludeScope=test -DexcludeArtifactIds=javassist,jsr305,spotbugs-annotations || die "fail to mvn copy-dependencies!" runCmd "${MVN_CMD[@]}" dependency:copy-dependencies -DincludeScope=test \
-DexcludeArtifactIds=javassist,jsr305,spotbugs-annotations,transmittable-thread-local \
|| die "fail to mvn copy-dependencies!"
fi fi
} }
getClasspathOfDependencies() { getCoreModuleClasspathOfDependencies() {
mvnCopyDependencies 1>&2 mvnCopyDependencies 1>&2
echo "$dependencies_dir"/*.jar | tr ' ' : echo "$core_module_dependencies_dir"/*.jar | tr ' ' :
} }
getClasspathWithoutTtlJar() { getKotlinSupportModuleClasspathOfDependencies() {
mvnCopyDependencies 1>&2
echo "$kotlin_support_module_dependencies_dir"/*.jar | tr ' ' :
}
getCoreModuleClasspathWithoutTtlJar() {
mvnCompileTest 1>&2 mvnCompileTest 1>&2
echo "library/target/test-classes:$(getClasspathOfDependencies)" echo "library/target/test-classes:$(getCoreModuleClasspathOfDependencies)"
}
getKotlinSupportModuleClasspathWithoutTtlJar() {
mvnCompileTest 1>&2
echo "kotlin-support/target/test-classes:library/target/test-classes:$(getCoreModuleClasspathOfDependencies)"
} }
getTtlJarPath() { getTtlJarPath() {
...@@ -158,11 +173,15 @@ getTtlJarPath() { ...@@ -158,11 +173,15 @@ getTtlJarPath() {
echo "$ttl_jar" echo "$ttl_jar"
} }
getClasspath() { getCoreModuleClasspath() {
echo "$(getTtlJarPath):$(getClasspathWithoutTtlJar)" echo "$(getTtlJarPath):$(getCoreModuleClasspathWithoutTtlJar)"
} }
getJUnitTestCases() { getKotlinSupportModuleClasspath() {
echo "$(getTtlJarPath):$(getKotlinSupportModuleClasspathWithoutTtlJar)"
}
getCoreModuleJUnitTestCases() {
( (
mvnCompileTest 1>&2 mvnCompileTest 1>&2
...@@ -175,6 +194,19 @@ getJUnitTestCases() { ...@@ -175,6 +194,19 @@ getJUnitTestCases() {
) )
} }
getKotlinSupportModuleJUnitTestCases() {
(
mvnCompileTest 1>&2
cd kotlin-support/target/test-classes &&
find . -iname '*Test.class' | sed '
s%^\./%%
s/\.class$//
s%/%.%g
'
)
}
################################################################################# #################################################################################
# maven actions # maven actions
################################################################################# #################################################################################
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
source ../common.sh source ../common.sh
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
com.alibaba.perf.memoryleak.NoMemoryLeak_ThreadLocal_NoRemove com.alibaba.perf.memoryleak.NoMemoryLeak_ThreadLocal_NoRemove
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
source ../common.sh source ../common.sh
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspath)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspath)" \
com.alibaba.perf.memoryleak.NoMemoryLeak_TransmittableThreadLocal_NoRemove com.alibaba.perf.memoryleak.NoMemoryLeak_TransmittableThreadLocal_NoRemove
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
source ../common.sh source ../common.sh
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
com.alibaba.perf.tps.CreateThreadLocalInstanceTps com.alibaba.perf.tps.CreateThreadLocalInstanceTps
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
source ../common.sh source ../common.sh
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspath)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspath)" \
com.alibaba.perf.tps.CreateTransmittableThreadLocalInstanceTps com.alibaba.perf.tps.CreateTransmittableThreadLocalInstanceTps
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
source ./common.sh source ./common.sh
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \ "-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \
com.alibaba.demo.ttl.agent.AgentDemo com.alibaba.demo.ttl.agent.AgentDemo
...@@ -7,6 +7,6 @@ shift 1 ...@@ -7,6 +7,6 @@ shift 1
cd "$(dirname "$(readlink -f "$0")")" cd "$(dirname "$(readlink -f "$0")")"
source ./common.sh source ./common.sh
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \ "-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \
"$run_class_name" "$run_class_name"
...@@ -9,24 +9,30 @@ source ./common.sh ...@@ -9,24 +9,30 @@ source ./common.sh
runCmd mvnBuildJar runCmd mvnBuildJar
blueEcho "Run unit test under ttl agent, include check for ExecutorService, ForkJoinPool" blueEcho "Run unit test under ttl agent, include check for ExecutorService, ForkJoinPool"
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \ "-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \
-Drun-ttl-test-under-agent=true \ -Drun-ttl-test-under-agent=true \
org.junit.runner.JUnitCore $(getJUnitTestCases) org.junit.runner.JUnitCore $(getCoreModuleJUnitTestCases)
blueEcho "Run unit test under ttl agent, and turn on the disable inheritable for thread pool enhancement" blueEcho "Run unit test under ttl agent, and turn on the disable inheritable for thread pool enhancement"
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT,ttl.agent.disable.inheritable.for.thread.pool:true" \ "-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT,ttl.agent.disable.inheritable.for.thread.pool:true" \
-Drun-ttl-test-under-agent=true \ -Drun-ttl-test-under-agent=true \
-Drun-ttl-test-under-agent-with-disable-inheritable=true \ -Drun-ttl-test-under-agent-with-disable-inheritable=true \
org.junit.runner.JUnitCore $(getJUnitTestCases) org.junit.runner.JUnitCore $(getCoreModuleJUnitTestCases)
blueEcho 'Run agent check for Timer/TimerTask, default "ttl.agent.enable.timer.task"' blueEcho 'Run agent check for Timer/TimerTask, default "ttl.agent.enable.timer.task"'
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \ "-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \
com.alibaba.ttl.threadpool.agent.check.timer.TimerAgentCheck com.alibaba.ttl.threadpool.agent.check.timer.TimerAgentCheck
blueEcho "Run agent check for Timer/TimerTask, explicit "ttl.agent.enable.timer.task"" blueEcho "Run agent check for Timer/TimerTask, explicit "ttl.agent.enable.timer.task""
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspathWithoutTtlJar)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT,ttl.agent.enable.timer.task:true" \ "-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT,ttl.agent.enable.timer.task:true" \
com.alibaba.ttl.threadpool.agent.check.timer.TimerAgentCheck com.alibaba.ttl.threadpool.agent.check.timer.TimerAgentCheck
blueEcho "Run unit test under ttl agent, check for Koroutine"
runCmd "${JAVA_CMD[@]}" -cp "$(getKotlinSupportModuleClasspathWithoutTtlJar)" \
"-javaagent:$(getTtlJarPath)=ttl.agent.logger:STDOUT" \
-Drun-ttl-test-under-agent=true \
org.junit.runner.JUnitCore $(getKotlinSupportModuleJUnitTestCases)
...@@ -5,6 +5,11 @@ cd "$(dirname "$(readlink -f "$0")")" ...@@ -5,6 +5,11 @@ cd "$(dirname "$(readlink -f "$0")")"
export TTL_CI_TEST_MODE=true export TTL_CI_TEST_MODE=true
source ./common.sh source ./common.sh
# run junit test for core module
# skip unit test for Javassist on command line, because Javassist is repackaged. # skip unit test for Javassist on command line, because Javassist is repackaged.
runCmd "${JAVA_CMD[@]}" -cp "$(getClasspath)" \ runCmd "${JAVA_CMD[@]}" -cp "$(getCoreModuleClasspath)" \
org.junit.runner.JUnitCore $(getJUnitTestCases | grep -vE '\.JavassistTest$') org.junit.runner.JUnitCore $(getCoreModuleJUnitTestCases | grep -vE '\.JavassistTest$')
# run junit test for kotlin-support module
runCmd "${JAVA_CMD[@]}" -cp "$(getKotlinSupportModuleClasspath)" \
org.junit.runner.JUnitCore $(getKotlinSupportModuleJUnitTestCases)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册