Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix directory management #303

Merged
merged 1 commit into from
Apr 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,7 @@ public abstract class SequenceValidator {
deviceMetadata = readDeviceMetadata();

deviceOutputDir = new File(new File(siteModel), "out/devices/" + deviceId);
try {
deviceOutputDir.mkdirs();
File testsOutputDir = new File(deviceOutputDir, TESTS_OUT_DIR);
FileUtils.deleteDirectory(testsOutputDir);
} catch (Exception e) {
throw new RuntimeException("While preparing " + deviceOutputDir.getAbsolutePath(), e);
}
deviceOutputDir.mkdirs();

resultSummary = new File(deviceOutputDir, RESULT_LOG_FILE);
resultSummary.delete();
Expand Down Expand Up @@ -171,8 +165,15 @@ public abstract class SequenceValidator {
public TestWatcher testWatcher = new TestWatcher() {
@Override
protected void starting(Description description) {
testName = description.getMethodName();
notice("starting test " + testName);
try {
testName = description.getMethodName();
File testsOutputDir = new File(new File(deviceOutputDir, TESTS_OUT_DIR), testName);
FileUtils.deleteDirectory(testsOutputDir);
testsOutputDir.mkdirs();
notice("starting test " + testName);
} catch (Exception e) {
throw new RuntimeException("While preparing " + deviceOutputDir.getAbsolutePath(), e);
}
}

@Override
Expand Down Expand Up @@ -368,7 +369,6 @@ private void recordRawMessage(Map<String, Object> message, String messageBase) {

String testOutDirName = TESTS_OUT_DIR + "/" + checkNotNull(testName);
File testOutDir = new File(deviceOutputDir, testOutDirName);
testOutDir.mkdirs();

File messageFile = new File(testOutDir, messageBase + ".json");
try {
Expand Down Expand Up @@ -418,7 +418,6 @@ private String writeLogEntry(Entry logEntry, String filename) {

String testOutDirName = TESTS_OUT_DIR + "/" + checkNotNull(testName);
File testOutDir = new File(deviceOutputDir, testOutDirName);
testOutDir.mkdirs();

File logFile = new File(testOutDir, filename);
try (PrintWriter logAppend = new PrintWriter(new FileOutputStream(logFile, true))) {
Expand Down