Skip to content

Commit

Permalink
Disable new validators for now
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoncek committed Sep 29, 2023
1 parent d3fda26 commit f5a06bb
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
4 changes: 4 additions & 0 deletions ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ prepare_test_env() {
}

execute() {
mkdir -p /tmp/jpv-classes
find /tmp/jpv-classes -exec touch -m -d '9999-01-01 00:00:00' {} +

for component in "${test_artifacts_dir}"/rpms/*; do
component="${component##*/}"
run_id="jpv-ci-${component}"
Expand All @@ -45,6 +48,7 @@ execute() {
run --id "${run_id}" \
-e TEST_ARTIFACTS="${test_artifacts_dir}/rpms/${component}/rpms" \
-e JP_VALIDATOR_IMAGE="${jp_validator_image}" \
-e JP_VALIDATOR_CLASSPATH="/tmp/jpv-classes" \
provision --how local \
execute --how tmt --no-progress-bar
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitOption;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributes;
Expand Down Expand Up @@ -116,7 +117,9 @@ private static Optional<FileTime> getRecursiveFileTime(Path path, BiPredicate<Pa
public static void compileFiles(Path sourcePath, Path classPath, Iterable<String> compilerOptions, Logger logger) throws IOException {
var sourceMtime = getRecursiveFileTime(sourcePath, (p, a) -> true).get();

if (Files.notExists(classPath)) {
if (Files.isSymbolicLink(classPath)) {
classPath = Files.readSymbolicLink(classPath);
} else {
Files.createDirectories(classPath);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,14 @@ List<Validator> select(List<Validator> validators) throws Exception {
List<?> exclude = List.class.cast(configuration.get("exclude-tests-matching"));
if (exclude != null) {
exclusions = exclude.stream().map(pattern -> Pattern.compile(String.class.cast(pattern))).toList();
logger.debug("Found exclusion patterns: {0}", Decorated.list(exclusions));
for (var validator : validators) {
if (exclusions.stream().anyMatch(pattern -> pattern.matcher(validator.getTestName()).matches())) {
parameters.validatorArgs.remove(validator.getClass().getCanonicalName());
for (var exclusionPattern : exclusions) {
if (exclusionPattern.matcher(validator.getTestName()).matches()) {
logger.debug("Exclusion pattern {0} matches test {1}", Decorated.actual(exclusionPattern), Decorated.struct(validator.getTestName()));
parameters.validatorArgs.remove(validator.getClass().getCanonicalName());
break;
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import org.fedoraproject.javadeptools.rpm.RpmFile;
import org.fedoraproject.javapackages.validator.Common;
import org.fedoraproject.javapackages.validator.Decorated;
import org.fedoraproject.javapackages.validator.TmtTest;

@TmtTest("/java/jpms-provides")
public class JpmsProvidesValidator extends JarValidator {
private Map<String, String> jarModuleNames = new TreeMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import org.fedoraproject.javadeptools.rpm.RpmFile;
import org.fedoraproject.javapackages.validator.Common;
import org.fedoraproject.javapackages.validator.Decorated;
import org.fedoraproject.javapackages.validator.TmtTest;

@TmtTest("/java/nvr-jar-metadata")
public class NVRMetadataValidator extends JarValidator {
private static interface Entry {
String name();
Expand Down Expand Up @@ -61,6 +63,19 @@ public String valueOf(RpmFile rpm) {

private static List<Entry> ENTRIES = List.of(new RpmName(), new RpmEpoch(), new RpmVersion(), new RpmRelease());

/*
public NVRMetadataValidator() {
super(rpm -> {
var release = rpm.getRelease();
int i = 0;
while (release.charAt(i) != '.') {
++i;
}
return release.substring(i + 1).startsWith("el");
});
}
*/

@Override
public void validateJarEntry(RpmFile rpm, CpioArchiveEntry rpmEntry, byte[] content) throws Exception {
try (var is = new JarInputStream(new ByteArrayInputStream(content))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ org.fedoraproject.javapackages.validator.validators.AttributeProvidesValidator
org.fedoraproject.javapackages.validator.validators.BytecodeVersionValidator
org.fedoraproject.javapackages.validator.validators.JavadocNoarchValidator
org.fedoraproject.javapackages.validator.validators.JavaExclusiveArchValidator
org.fedoraproject.javapackages.validator.validators.JpmsProvidesValidator
org.fedoraproject.javapackages.validator.validators.MavenMetadataValidator
org.fedoraproject.javapackages.validator.validators.NVRMetadataValidator

0 comments on commit f5a06bb

Please sign in to comment.