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