Compare commits

..

20 commits

Author SHA1 Message Date
Mikolaj Izdebski
fa142264da Merge branch 'main' into c10s 2024-12-18 12:41:10 +01:00
Marian Koncek
cdde8ee0c4 Revert "Run tests only on x86_64"
This reverts commit ab75ca899d.
2024-08-15 10:20:11 +02:00
Mikolaj Izdebski
ab75ca899d Run tests only on x86_64 2024-08-14 16:21:21 +02:00
Mikolaj Izdebski
bacaa3fac6 Fix a typo in generic flavor factory 2024-08-09 10:26:04 +02:00
Mikolaj Izdebski
04ea350a32 Drop deprecated vanilla jpv_flavor 2024-08-09 10:00:58 +02:00
Mikolaj Izdebski
0155ec6aad Use SAX-PD-2.0 license instead of SAX-PD 2024-08-07 08:52:26 +02:00
Mikolaj Izdebski
08ba815c91 Merge branch 'f41' into c10s 2024-08-02 12:11:20 +02:00
Mikolaj Izdebski
d9697fe3e6 Merge branch 'f41' into c10s 2024-08-01 17:42:23 +02:00
Mikolaj Izdebski
435956e755 Merge branch 'f41' into c10s 2024-08-01 17:35:28 +02:00
Mikolaj Izdebski
fb7e6ae5b3 Merge branch 'f41' into c10s 2024-08-01 15:39:32 +02:00
Mikolaj Izdebski
aa94813c36 Merge branch 'f41' into c10s 2024-08-01 15:27:45 +02:00
Mikolaj Izdebski
94b1bd7545 Provisionally allow /usr/share/doc/ for javadoc packages 2024-08-01 08:27:31 +02:00
Mikolaj Izdebski
3716dc184a Merge branch 'f41' into c10s 2024-08-01 08:24:19 +02:00
Marian Koncek
fd9733cb95 Add c10s-specific validators to the vanilla flavor 2024-07-18 12:23:23 +02:00
Mikolaj Izdebski
131a09bfe4 Implement jpv_flavor fmf dimension
Vanilla flavor runs unmodified upstream validator, skipping extra
validators from src/ directory.
2024-07-17 20:16:17 +02:00
Mikolaj Izdebski
433737f45d Enable JPMS and NVR metadata validators for RHEL 10 2024-07-11 16:27:38 +02:00
Mikolaj Izdebski
49efc441d9 Disable built-in validator factory
Disable the use of upstream DefaultValidatorFactory, so that we have
more control of which validators are executed.
2024-07-11 16:26:24 +02:00
Marian Koncek
ed326c9eb1 Put javapackages test code into a separate shell script 2024-07-10 11:43:00 +02:00
Marian Koncek
6cb24ea1a1 Unify indentation to use 2 spaces 2024-07-09 15:30:53 +02:00
Marian Koncek
efe08cfac1 Add more javapackages test metadata 2024-07-09 15:29:56 +02:00
7 changed files with 27 additions and 49 deletions

View file

@ -1,5 +1,23 @@
# Deprecated
# javapackages-validator-tests
This repository is deprecated.
This repository contains the `.fmf` test files referenced by packages that are tested by _javapackages-validator_ tool.
Javapackages tests were moved to https://gitlab.com/redhat/centos-stream/tests/javapackages
## Versioning
The version scheme is based on Fedora versions (`f<NUM>`).
Changes made to a single branch must be backwards compatible or fix a bug.
Breaking changes can be made to a branch that corresponds to the Rawhide branch at the time of submission.
Packages then explicitly update their git reference and new versions of the package will be tested with the new tests.
This approach ensures that changes to old versions of packages will not be tested with possibly incompatible tests.
## Forking
If you wish to fork this project and add your own tests, you should follow these steps:
1. Add a source directory (e.g. `src`) with your own validators.
2. Add a text [service file](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ServiceLoader.html) named `org.fedoraproject.javapackages.validator.Validator` into the same directory.
This file contains fully-qualified class names of validators which you want to use, one name per line.
Javapackages-validator will run all the validators listed in the service file, unless they have been explicitly filtered using per-package configuration.
This is explained in the project documentation.

View file

@ -68,10 +68,7 @@ public class FilesValidatorJP extends FilesValidator {
prefixes.put("javacc", List.of(Prefix.USR_BIN));
prefixes.put("java_cup", List.of(Prefix.USR_BIN));
prefixes.put("jflex", List.of(Prefix.USR_BIN));
prefixes.put("jline", List.of(Prefix.USR_LIB_BUILD_ID));
prefixes.put("junit5", List.of(Prefix.USR_BIN));
prefixes.put("maven", List.of(Prefix.ETC_PKG, Prefix.ETC_JAVA, Prefix.JPBINDING, Prefix.USR_BIN));
prefixes.put("maven4", List.of(Prefix.ETC_PKG, Prefix.ETC_JAVA, Prefix.JPBINDING, Prefix.USR_BIN));
prefixes.put("modello", List.of(Prefix.USR_BIN));
prefixes.put("objectweb-asm", List.of(Prefix.USR_BIN));
prefixes.put("xerces-j2", List.of(Prefix.USR_BIN));
@ -84,9 +81,7 @@ public class FilesValidatorJP extends FilesValidator {
static {
exceptionalFiles.put("aqute-bnd", List.of("/etc/ant.d/aqute-bnd"));
exceptionalFiles.put("maven", List.of("/etc/m2.conf"));
exceptionalFiles.put("maven4", List.of("/etc/m24.conf"));
exceptionalFiles.put("jansi", List.of("/usr/lib/jansi", "/usr/lib/jansi/libjansi.so", "/usr/lib/java/jansi"));
exceptionalFiles.put("jline", List.of("/usr/lib/jline", "/usr/lib/jline/libjlinenative.so", "/usr/lib/java/jline"));
}
private static boolean namesRelated(String lhs, String rhs) {

View file

@ -18,7 +18,7 @@ public class RpmFilesizeValidatorJP extends RpmFilesizeValidator {
}
if (Common.getPackageName(rpm).equals("javapackages-bootstrap")) {
return sizeBytes <= 60_000_000;
return sizeBytes <= 40_000_000;
}
// javadoc rpms
@ -33,6 +33,6 @@ public class RpmFilesizeValidatorJP extends RpmFilesizeValidator {
}
}
return sizeBytes <= 4_000_000;
return sizeBytes <= 3_500_000;
}
}

View file

@ -15,6 +15,8 @@ public class ValidatorFactoryGeneric implements ValidatorFactory {
new JavaExclusiveArchValidatorJP(),
new MavenMetadataValidator(),
new NoBootstrapValidator(),
new JpmsProvidesValidatorJP(),
new NVRJarMetadataValidator(),
});
}
}

View file

@ -1,37 +0,0 @@
package tests;
import static io.kojan.runit.api.RUnit.*;
import static io.kojan.runit.api.matcher.RUnitMatchers.*;
import static org.hamcrest.Matchers.*;
import java.nio.charset.StandardCharsets;
import org.junit.jupiter.api.DisplayName;
import io.kojan.javadeptools.rpm.RpmInfo;
import io.kojan.runit.api.ExcludeFileName;
import io.kojan.runit.api.ExcludeSource;
import io.kojan.runit.api.ExcludeSymlink;
import io.kojan.runit.api.FileTest;
import io.kojan.runit.api.IncludeFileName;
@DisplayName("/jpackage_script")
public class JPackageScriptCheck {
@FileTest
@IncludeFileName("/usr/bin/.*")
@ExcludeSource
@ExcludeSymlink
@ExcludeFileName("/usr/bin/ant")
public void testJPackageScript(RpmInfo rpm, byte[] bytes) {
assumeThat("The binary is a script with a shebang", bytes.length, greaterThan(1));
assumeThat("The binary is a script with a shebang", bytes[0], is((byte)'#'));
assumeThat("The binary is a script with a shebang", bytes[1], is((byte)'!'));
String content = new String(bytes, StandardCharsets.UTF_8);
assumeThat("The script was generated with %jpackage_script", content,
containsString(". /usr/share/java-utils/java-functions\n"));
assertThat("The script explicitly sets JAVA_HOME to Java 21", content,
containsString("\nJAVA_HOME=\"${JAVA_HOME:-/usr/lib/jvm/jre-21-openjdk}\"\n"));
assertThat("Requires on java-21-openjdk-headless are present", rpm, requires("java-21-openjdk-headless"));
assertThat("Requires on javapackages-tools are present", rpm, requires("javapackages-tools"));
}
}

View file

@ -23,6 +23,7 @@ public class JavadocCheck {
@IncludeBinary(".*-javadoc")
public void javadocFiles(RpmInfo rpm, Path path) {
assertThat("Javadoc package contains only javadoc content", path.toString(),
anyOf(startsWith("/usr/share/javadoc/"), startsWith("/usr/share/licenses/")));
anyOf(startsWith("/usr/share/doc/"), // provisional for c10s
startsWith("/usr/share/javadoc/"), startsWith("/usr/share/licenses/")));
}
}

View file

@ -56,7 +56,6 @@ public class LicenseCheck {
private static final Set<String> PUBLIC_DOMAIN_PACKAGES = Set.of( //
"aopalliance", //
"plexus-utils", //
"plexus-utils4", //
"xz-java", //
"javapackages-bootstrap" // special case, as it it bundles all the above
);