@@ -65,7 +65,13 @@ public void run(CommandExecutor executor, String cmd, Path path) {
65
65
output .stderrShouldBeEmpty ();
66
66
output .stdoutShouldBeEmpty ();
67
67
68
- Assert .assertTrue (Files .exists (path ), "File must exist: " + path );
68
+ try {
69
+ Assert .assertTrue (Files .exists (path ), "File must exist: " + path );
70
+ Assert .assertTrue (Files .size (path ) > 0 ,
71
+ "File must not be empty. Possible file permission issue: " + path );
72
+ } catch (IOException e ) {
73
+ throw new RuntimeException (e );
74
+ }
69
75
70
76
// Sanity check the file contents
71
77
try {
@@ -79,10 +85,11 @@ public void run(CommandExecutor executor, String cmd, Path path) {
79
85
}
80
86
81
87
@ Test
82
- public void defaultMapFile () {
88
+ public void defaultMapFile () throws IOException {
83
89
final long pid = ProcessHandle .current ().pid ();
84
90
final Path path = Paths .get (String .format ("/tmp/perf-%d.map" , pid ));
85
91
run (new JMXExecutor (), "Compiler.perfmap" , path );
92
+ Files .deleteIfExists (path );
86
93
}
87
94
88
95
@ Test
@@ -96,13 +103,14 @@ public void specifiedMapFile() {
96
103
}
97
104
98
105
@ Test
99
- public void specifiedDefaultMapFile () {
106
+ public void specifiedDefaultMapFile () throws IOException {
100
107
// This is a special case of specifiedMapFile() where the filename specified
101
108
// is the same as the default filename as given in the help output. The dcmd
102
109
// should treat this literally as the filename and not expand <pid> into
103
110
// the actual PID of the process.
104
111
String test_dir = System .getProperty ("test.dir" , "." );
105
112
Path path = Paths .get ("/tmp/perf-<pid>.map" );
106
113
run (new JMXExecutor (), "Compiler.perfmap " + path .toString (), path );
114
+ Files .deleteIfExists (path );
107
115
}
108
116
}
0 commit comments