8217473: SA: Tests using ClhsdbLauncher fail on SAP docker containers
Summary: Skip the test with jtreg.SkippedException if Platform.shouldSAAttach() returns false
Reviewed-by: dholmes, goetz
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbAttach.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbAttach.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
/**
* @test
@@ -68,6 +69,8 @@
"longConstant markOopDesc::locked_value"));
test.run(-1, cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbField.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
/**
* @test
@@ -63,6 +64,8 @@
"field nmethod _entry_bci int",
"field Universe _collectedHeap CollectedHeap"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbFindPC.java Fri Feb 01 11:29:31 2019 +0530
@@ -27,6 +27,8 @@
import java.util.ArrayList;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
+
/**
* @test
* @bug 8193124
@@ -91,6 +93,8 @@
test.run(theApp.getPid(), cmds, expStrMap, null);
}
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbFlags.java Fri Feb 01 11:29:31 2019 +0530
@@ -29,6 +29,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
import jdk.test.lib.Utils;
+import jtreg.SkippedException;
/**
* @test
@@ -82,6 +83,8 @@
"MaxJavaStackTraceDepth = 1024"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java Fri Feb 01 11:29:31 2019 +0530
@@ -57,13 +57,6 @@
String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
- if (jstackOutput == null) {
- // Output could be null due to attach permission issues
- // and if we are skipping this.
- LingeredApp.stopApp(theApp);
- throw new SkippedException("attach permission issues");
- }
-
Map<String, String> tokensMap = new HashMap<>();
tokensMap.put("(a java.lang.Class for LingeredAppWithLock)",
"instance of Oop for java/lang/Class");
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJdis.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -57,11 +57,6 @@
// the 'jstack -v' command
cmds = new ArrayList<String>();
- // Output could be null if the test was skipped due to
- // attach permission issues.
- if (output == null) {
- throw new SkippedException("attach permission issues");
- }
String cmdStr = null;
String[] parts = output.split("LingeredApp.main");
String[] tokens = parts[1].split(" ");
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Utils;
+import jtreg.SkippedException;
/**
* @test
@@ -68,6 +69,8 @@
"ParselTongue"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbJstack.java Fri Feb 01 11:29:31 2019 +0530
@@ -27,6 +27,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
+import jtreg.SkippedException;
/**
* @test
@@ -64,6 +65,8 @@
"LingeredApp.main"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR (with -Xcomp=" + withXcomp + ") " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java Fri Feb 01 11:29:31 2019 +0530
@@ -33,6 +33,7 @@
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.SA.SATestUtils;
+import jtreg.SkippedException;
/**
@@ -177,22 +178,18 @@
List<String> commands,
Map<String, List<String>> expectedStrMap,
Map<String, List<String>> unExpectedStrMap)
- throws IOException, InterruptedException {
+ throws Exception {
if (!Platform.shouldSAAttach()) {
- if (Platform.isOSX()) {
- if (!SATestUtils.canAddPrivileges()) {
- // Skip the test if we don't have enough permissions to attach
- // and cannot add privileges.
- System.out.println("SA attach not expected to work - test skipped.");
- return null;
- } else {
- needPrivileges = true;
- }
- } else {
- System.out.println("SA attach not expected to work. Insufficient privileges.");
- throw new Error("Cannot attach.");
+ if (Platform.isOSX() && SATestUtils.canAddPrivileges()) {
+ needPrivileges = true;
}
+ else {
+ // Skip the test if we don't have enough permissions to attach
+ // and cannot add privileges.
+ throw new SkippedException(
+ "SA attach not expected to work. Insufficient privileges.");
+ }
}
attach(lingeredAppPid);
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,9 +75,6 @@
String longConstantOutput = test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
- if (longConstantOutput == null) {
- throw new SkippedException("attach permission issues");
- }
checkForTruncation(longConstantOutput);
} catch (SkippedException e) {
throw e;
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPmap.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
+import jtreg.SkippedException;
/**
* @test
@@ -57,6 +58,8 @@
"jimage", "zip", "verify"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
/**
* @test
@@ -68,6 +69,8 @@
unExpStrMap.put("printall", List.of(
"cannot be cast to"));
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAs.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,11 +55,6 @@
String jstackOutput = test.run(theApp.getPid(), cmds, null, null);
- if (jstackOutput == null) {
- LingeredApp.stopApp(theApp);
- throw new SkippedException("attach permission issues");
- }
-
String[] snippets = jstackOutput.split("LingeredApp.main");
String addressString = null;
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintStatics.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintStatics.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
+import jtreg.SkippedException;
/**
* @test
@@ -83,6 +84,8 @@
"bool JvmtiExport::_can_post_on_exceptions"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbPstack.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbPstack.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
+import jtreg.SkippedException;
/**
* @test
@@ -58,6 +59,8 @@
"Reference Handler", "Finalizer", "main"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,11 +70,6 @@
unExpStrMap.put("g1regiondetails", List.of("Unknown Region Type"));
String regionDetailsOutput = test.run(theApp.getPid(), cmds,
expStrMap, unExpStrMap);
- if (regionDetailsOutput == null) {
- LingeredApp.stopApp(theApp);
- throw new SkippedException("attach permission issues");
- }
-
// Test the output of 'scanoops' -- get the start and end addresses
// from the StartsHumongous region. Ensure that it contains an
// array of Strings.
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbScanOops.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,11 +58,6 @@
String universeOutput = test.run(theApp.getPid(), cmds, null, null);
- if (universeOutput == null) {
- LingeredApp.stopApp(theApp);
- throw new SkippedException("attach permission issues");
- }
-
cmds = new ArrayList<String>();
Map<String, List<String>> expStrMap = new HashMap<>();
Map<String, List<String>> unExpStrMap = new HashMap<>();
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbSource.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
/**
* @test
@@ -74,6 +75,8 @@
test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
Files.delete(file);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbThread.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbThread.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
/**
* @test
@@ -76,14 +77,6 @@
expStrMap,
unExpStrMap);
- if (consolidatedOutput == null) {
- // Output could be null due to attach permission issues.
- System.out.println(
- "Output is empty. Probably due to attach permission issues.");
- LingeredApp.stopApp(theApp);
- return;
- }
-
// Test the thread <id> command now. Obtain <id> from the
// output of the previous 'threads' command. The word before
// the token 'Finalizer' should denote the thread id of the
@@ -109,6 +102,8 @@
"Last_Java_SP"));
cmds = List.of(cmd);
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbVmStructsDump.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import jdk.test.lib.apps.LingeredApp;
+import jtreg.SkippedException;
/**
* @test
@@ -63,6 +64,8 @@
"type Universe null",
"type ConstantPoolCache MetaspaceObj"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {
--- a/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java Thu Jan 31 17:48:29 2019 -0800
+++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java Fri Feb 01 11:29:31 2019 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.Platform;
+import jtreg.SkippedException;
/**
* @test
@@ -63,6 +64,8 @@
"public static void main"));
test.run(theApp.getPid(), cmds, expStrMap, null);
+ } catch (SkippedException se) {
+ throw se;
} catch (Exception ex) {
throw new RuntimeException("Test ERROR " + ex, ex);
} finally {