8359083: Test jdkCheckHtml.java should report SkippedException rather than report fails when miss tidy

Reviewed-by: hannesw
This commit is contained in:
SendaoYan 2025-06-12 08:18:00 +00:00
parent 7b7136b4ec
commit 3e0ef832cc
3 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, 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
@ -140,6 +140,9 @@ public class DocCheck extends TestRunner {
var baseDir = DOCS_DIR.resolve(DIR);
fileTester.processFiles(baseDir);
files = fileTester.getFiles();
if (html) {
new TidyChecker();
}
}
public List<FileChecker> getCheckers() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, 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,6 @@
* @bug 8337109
* @summary Check the html in the generated documentation
* @library /test/langtools/tools/lib ../../doccheck /test/lib ../../../../tools/tester
* @build DocTester toolbox.TestRunner
* @build DocTester toolbox.TestRunner jtreg.SkippedException
* @run main/othervm -Ddoccheck.checks=html DocCheck
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, 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
@ -38,6 +38,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jtreg.SkippedException;
public class TidyChecker implements FileChecker, AutoCloseable {
private final Path TIDY;
@ -164,8 +165,7 @@ public class TidyChecker implements FileChecker, AutoCloseable {
if (p.isPresent()) {
tidyExePath = p.get();
} else {
System.err.println("tidy not found on PATH");
return Path.of("tidy"); //non-null placeholder return; exception would be better
throw new jtreg.SkippedException("tidy not found on PATH");
}
}