You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by er...@apache.org on 2022/09/23 03:57:15 UTC
[iotdb] 01/01: Test reporter will never fail due to path
This is an automated email from the ASF dual-hosted git repository.
ericpai pushed a commit to branch improve/test-reporter
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 76368fcda5b28dd1fb10a3ad237d03db32f74ab3
Author: ericpai <er...@hotmail.com>
AuthorDate: Fri Sep 23 11:56:53 2022 +0800
Test reporter will never fail due to path
---
.../apache/iotdb/it/framework/IoTDBTestReporter.java | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/integration-test/src/main/java/org/apache/iotdb/it/framework/IoTDBTestReporter.java b/integration-test/src/main/java/org/apache/iotdb/it/framework/IoTDBTestReporter.java
index 11adafacaf..200f382806 100644
--- a/integration-test/src/main/java/org/apache/iotdb/it/framework/IoTDBTestReporter.java
+++ b/integration-test/src/main/java/org/apache/iotdb/it/framework/IoTDBTestReporter.java
@@ -18,6 +18,7 @@
*/
package org.apache.iotdb.it.framework;
+import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -31,12 +32,17 @@ public class IoTDBTestReporter {
public static void main(String[] args) throws IOException {
List<IoTDBTestStat> stats = new ArrayList<>();
- try (Stream<Path> s =
- Files.walk(
- Paths.get(
- System.getProperty("user.dir"),
- "integration-test",
- IoTDBTestListener.statOutputDir))) {
+ Path outputDirPath =
+ Paths.get(
+ System.getProperty("user.dir"), "integration-test", IoTDBTestListener.statOutputDir);
+ File outputDir = outputDirPath.toFile();
+ if (!outputDir.exists() || !outputDir.isDirectory()) {
+ IoTDBTestLogger.logger.error(
+ "the output dir {} is not a valid directory, the reporter will be aborted",
+ outputDirPath);
+ return;
+ }
+ try (Stream<Path> s = Files.walk(outputDirPath)) {
s.forEach(
source -> {
if (source.toString().endsWith(IoTDBTestListener.statExt)) {