|
|
78a2f7 |
From 888f4a58a82e2d265fc95907492a24c95978e605 Mon Sep 17 00:00:00 2001
|
|
|
78a2f7 |
From: Jakub Filak <jfilak@redhat.com>
|
|
|
78a2f7 |
Date: Fri, 17 Jan 2014 14:20:51 +0100
|
|
|
78a2f7 |
Subject: [PATCH 25/39] Update the missing class test
|
|
|
78a2f7 |
|
|
|
78a2f7 |
The ClassNotFound exception which is thrown in case of a not existing
|
|
|
78a2f7 |
main class file is caught by Java Native Interface and java process
|
|
|
78a2f7 |
exits gracefully with an error message:
|
|
|
78a2f7 |
|
|
|
78a2f7 |
Error: Could not find or load main class MissingClassTest
|
|
|
78a2f7 |
|
|
|
78a2f7 |
It doesn't make sense to report such exceptions because this exception
|
|
|
78a2f7 |
would be reported every time when someone run "java foo" where 'foo'
|
|
|
78a2f7 |
does not exist.
|
|
|
78a2f7 |
|
|
|
78a2f7 |
Just for the record, ABRT doesn't detect the similar problem in python.
|
|
|
78a2f7 |
|
|
|
78a2f7 |
$ python foo
|
|
|
78a2f7 |
python: can't open file 'foo': [Errno 2] No such file or directory
|
|
|
78a2f7 |
|
|
|
78a2f7 |
Related to rhbz#1051198
|
|
|
78a2f7 |
---
|
|
|
78a2f7 |
test/CMakeLists.txt | 20 ++++++++++++++------
|
|
|
78a2f7 |
test/outputs/run_missing_class_test.log.in | 10 ----------
|
|
|
78a2f7 |
2 files changed, 14 insertions(+), 16 deletions(-)
|
|
|
78a2f7 |
delete mode 100644 test/outputs/run_missing_class_test.log.in
|
|
|
78a2f7 |
|
|
|
78a2f7 |
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
|
|
|
78a2f7 |
index 5267e7b..1a851e6 100644
|
|
|
78a2f7 |
--- a/test/CMakeLists.txt
|
|
|
78a2f7 |
+++ b/test/CMakeLists.txt
|
|
|
78a2f7 |
@@ -171,14 +171,22 @@ _add_test_target(
|
|
|
78a2f7 |
)
|
|
|
78a2f7 |
_add_test(run_bad_class 2)
|
|
|
78a2f7 |
|
|
|
78a2f7 |
-_add_test_target(
|
|
|
78a2f7 |
+# Disabled because JVM catches the ClassNotFoundException in a native method and exits gracefully
|
|
|
78a2f7 |
+#_add_test_target(
|
|
|
78a2f7 |
+# run_missing_class_test
|
|
|
78a2f7 |
+# MissingClassTest
|
|
|
78a2f7 |
+# PRE rm -f MissingClassTest.class
|
|
|
78a2f7 |
+# DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
|
|
|
78a2f7 |
+# AGENT_OPTIONS executable=threadclass
|
|
|
78a2f7 |
+#)
|
|
|
78a2f7 |
+#_add_test(run_missing_class_test 2)
|
|
|
78a2f7 |
+add_custom_target(
|
|
|
78a2f7 |
run_missing_class_test
|
|
|
78a2f7 |
- MissingClassTest
|
|
|
78a2f7 |
- PRE rm -f MissingClassTest.class
|
|
|
78a2f7 |
- DEPENDS ${TEST_JAVA_TARGETS} ${JAR_TEST_PATH}
|
|
|
78a2f7 |
- AGENT_OPTIONS executable=threadclass
|
|
|
78a2f7 |
+ COMMAND rm -f MissingClassTest.class && LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src ${Java_JAVA_EXECUTABLE} -agentlib:${AGENT_NAME}=output=run_missing_class.log MissingClassTest || test ! -e run_missing_class.log
|
|
|
78a2f7 |
+ DEPENDS AbrtChecker ${TEST_JAVA_TARGETS}
|
|
|
78a2f7 |
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
|
78a2f7 |
)
|
|
|
78a2f7 |
-_add_test(run_missing_class_test 2)
|
|
|
78a2f7 |
+add_test(test_run_missing_class_test make run_missing_class_test)
|
|
|
78a2f7 |
|
|
|
78a2f7 |
_add_test_target(
|
|
|
78a2f7 |
run_try_finally
|
|
|
78a2f7 |
diff --git a/test/outputs/run_missing_class_test.log.in b/test/outputs/run_missing_class_test.log.in
|
|
|
78a2f7 |
deleted file mode 100644
|
|
|
78a2f7 |
index ea3dc25..0000000
|
|
|
78a2f7 |
--- a/test/outputs/run_missing_class_test.log.in
|
|
|
78a2f7 |
+++ /dev/null
|
|
|
78a2f7 |
@@ -1,10 +0,0 @@
|
|
|
78a2f7 |
-Uncaught exception java.lang.ClassNotFoundException in method java.lang.ClassLoader.loadClass()
|
|
|
78a2f7 |
-Exception in thread "main" java.lang.ClassNotFoundException: MissingClassTest
|
|
|
78a2f7 |
- at java.net.URLClassLoader$1.run(URLClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/net/URLClassLoader$1.class]
|
|
|
78a2f7 |
- at java.net.URLClassLoader$1.run(URLClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/net/URLClassLoader$1.class]
|
|
|
78a2f7 |
- at java.security.AccessController.doPrivileged(Native Method) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/security/AccessController.class]
|
|
|
78a2f7 |
- at java.net.URLClassLoader.findClass(URLClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/net/URLClassLoader.class]
|
|
|
78a2f7 |
- at java.lang.ClassLoader.loadClass(ClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/lang/ClassLoader.class]
|
|
|
78a2f7 |
- at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/sun/misc/Launcher$AppClassLoader.class]
|
|
|
78a2f7 |
- at java.lang.ClassLoader.loadClass(ClassLoader.java:LINENO) [jar:file:JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar!/java/lang/ClassLoader.class]
|
|
|
78a2f7 |
-executable: JAVA_AND_SYSTEM_SPECIFIC_PATH/rt.jar
|
|
|
78a2f7 |
--
|
|
|
78a2f7 |
1.8.3.1
|
|
|
78a2f7 |
|