gprofng: Skip jsynprog with a broken javac
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 14 Mar 2022 22:38:04 +0000 (15:38 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 17 Mar 2022 17:28:58 +0000 (10:28 -0700)
On CET enabled Linux/x86-64 machines, one can get

$ javac simple.java
Error: dl failure on line 894
Error: failed /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so, because /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-6.fc35.x86_64/jre/lib/amd64/server/libjvm.so: rebuild shared object with SHSTK support enabled

Set GPROFNG_BROKEN_JAVAC to "yes" only with a broken javac and skip the
jsynprog test with a broken javac.

PR gprofng/28965
* Makefile.am (GPROFNG_BROKEN_JAVAC): New.
(check-DEJAGNU): Pass GPROFNG_BROKEN_JAVAC to runtest.
* configure.ac (GPROFNG_BROKEN_JAVAC): New AC_SUBST.  Set to yes
with a broken javac.
* Makefile.in: Regenerate.
* configure: Likewise.
* testsuite/gprofng.display/display.exp: Skip jsynprog with a
broken javac.

gprofng/Makefile.am
gprofng/Makefile.in
gprofng/configure
gprofng/configure.ac
gprofng/testsuite/gprofng.display/display.exp

index 3bf707412ca04f33a5d1a9fc9fe81efc5d7c1c42..e06769cbf90d5e254594e72462a15484f74f0fce 100644 (file)
@@ -41,6 +41,7 @@ LD_NO_AS_NEEDED = @LD_NO_AS_NEEDED@
 GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
 GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
 GPROFNG_LIBDIR = @GPROFNG_LIBDIR@
+GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
 
 AM_MAKEFLAGS = \
        jdk_inc="$(jdk_inc)" \
@@ -59,6 +60,7 @@ check-DEJAGNU: site.exp development.exp
        runtest=$(RUNTEST); \
        if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
          $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+               GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
                MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
                LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
                BUILDDIR="$(abs_top_builddir)" $(RUNTESTFLAGS); \
index 599fce5e879d8af5f80b508217b75e73f0bcea9f..27889c0f35976259b44f60fc14245b6d869ead34 100644 (file)
@@ -262,6 +262,7 @@ EXEEXT = @EXEEXT@
 # Setup the testing framework, if you have one
 EXPECT = expect
 FGREP = @FGREP@
+GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
 GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
 GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
 GPROFNG_LIBADD = @GPROFNG_LIBADD@
@@ -934,6 +935,7 @@ uninstall-am:
 @TCL_TRY_TRUE@ runtest=$(RUNTEST); \
 @TCL_TRY_TRUE@ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
 @TCL_TRY_TRUE@   $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \
+@TCL_TRY_TRUE@         GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \
 @TCL_TRY_TRUE@         MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS) $(PTHREAD_CFLAGS)" \
 @TCL_TRY_TRUE@         LDFLAGS="$(LDFLAGS)" LIBS="$(PTHREAD_LIBS) $(LIBS)" \
 @TCL_TRY_TRUE@         BUILDDIR="$(abs_top_builddir)" $(RUNTESTFLAGS); \
index 23a5dd8ef8e9d961aa5a1565920df5305816f29a..983150f4f763616241d5b0c796384f7554a5dd45 100755 (executable)
@@ -645,6 +645,7 @@ TCL_TRY_FALSE
 TCL_TRY_TRUE
 EXPECT
 jdk_inc
+GPROFNG_BROKEN_JAVAC
 JAVA
 JAVAC
 PTHREAD_CFLAGS
@@ -12135,7 +12136,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12138 "configure"
+#line 12139 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12241,7 +12242,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 12244 "configure"
+#line 12245 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16528,6 +16529,7 @@ fi
 
 
 fi
+GPROFNG_BROKEN_JAVAC=no
 if test "x$enable_gprofng_jp" = x; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:  Cannot find the JDK include directory.
       gprofng will be build without support for profiling Java applications.
@@ -16539,9 +16541,30 @@ else
 
 $as_echo "#define GPROFNG_JAVA_PROFILING 1" >>confdefs.h
 
+    if test "x$JAVAC" != x; then
+      cat > configtest.java << EOF
+class Simple{
+  public static void main(String args){
+    System.out.println("Hello Java");
+  }
+}
+EOF
+      if { ac_try='$JAVAC conftest.java &5 2>&1'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+       GPROFNG_BROKEN_JAVAC=no
+      else
+       GPROFNG_BROKEN_JAVAC=yes
+      fi
+      rm -f configtest.*
+    fi
 fi
 
 
+
 DEBUG=
  # Check whether --enable-gprofng-debug was given.
 if test "${enable_gprofng_debug+set}" = set; then :
index c05e98192f36007893069c7f02e27d1f90127d14..7fcf6c3b1dbcae272bd0492c20d0159678f1d1f7 100644 (file)
@@ -128,13 +128,30 @@ fi
 if test "x$enable_gprofng_jp" = x; then
   AC_CHECK_HEADER([jni.h], [ enable_gprofng_jp=yes ], [], [] )
 fi
+GPROFNG_BROKEN_JAVAC=no
 if test "x$enable_gprofng_jp" = x; then
     AC_MSG_WARN([ Cannot find the JDK include directory.
       gprofng will be build without support for profiling Java applications.
       Use --with-jdk=PATH to specify directory for the installed JDK])
 else
     AC_DEFINE(GPROFNG_JAVA_PROFILING, 1, [Enable java profiling])
+    if test "x$JAVAC" != x; then
+      cat > configtest.java << EOF
+class Simple{
+  public static void main(String args[]){
+    System.out.println("Hello Java");
+  }
+}
+EOF
+      if AC_TRY_COMMAND($JAVAC conftest.java &AS_MESSAGE_LOG_FD 2>&1); then
+       GPROFNG_BROKEN_JAVAC=no
+      else
+       GPROFNG_BROKEN_JAVAC=yes
+      fi
+      rm -f configtest.*
+    fi
 fi
+AC_SUBST(GPROFNG_BROKEN_JAVAC)
 AC_SUBST(jdk_inc)
 
 DEBUG=
index 108144c069a9495fc75b8b50d1ba5ee209037cac..dfb383e9fc63e2cde5c8589a6fa854bc9ac0b943 100644 (file)
@@ -68,6 +68,8 @@ switch $pltf {
   }
 }
 
+global GPROFNG_BROKEN_JAVAC
+
 foreach line $table {
   set dir [lindex $line 0]
   set cflags [lindex $line 1]
@@ -75,7 +77,11 @@ foreach line $table {
 
   verbose [file rootname $line]
   verbose running display test $line
-  run_display_test $dir $cflags $gprofflags
+  if { $GPROFNG_BROKEN_JAVAC == "yes" && $dir == "jsynprog" } {
+    unsupported $dir
+  } else {
+    run_display_test $dir $cflags $gprofflags
+  }
 }