Skip to content

Commit

Permalink
Fix CPU test to allow multiple valid CPU types
Browse files Browse the repository at this point in the history
Also fix CI so that if the macos tests run on aarch64, it still works.
  • Loading branch information
dmlloyd committed Apr 30, 2024
1 parent e03a56a commit eae407f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: build with maven
run: |
mvn -q -N "io.takari:maven:${{env.IO_TAKARI_MAVEN_WRAPPER_VERSION}}:wrapper" "-Dmaven=${{env.MAVEN_VERSION}}"
./mvnw -B -ntp formatter:validate verify --file pom.xml "-Dexpected-cpu=x64" "-Djava11.home=${{env.JAVA_HOME_11_X64}}"
./mvnw -B -ntp formatter:validate verify --file pom.xml "-Dexpected-cpu=x64,aarch64" "-Djava11.home=${{env.JAVA_HOME_11_X64}}${{env.JAVA_HOME_11_ARM64}}" "-Djava17.home=${{env.JAVA_HOME_17_X64}}${{env.JAVA_HOME_17_ARM64}}"
quality:
needs: [ build ]
Expand Down
5 changes: 4 additions & 1 deletion cpu/src/test/java/io/smallrye/common/cpu/CPUTests.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.smallrye.common.cpu;

import java.util.Set;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
Expand All @@ -13,6 +15,7 @@ public final class CPUTests {
public void testCpu() {
String expectedCpuName = System.getProperty("expected-cpu");
Assumptions.assumeTrue(expectedCpuName != null && !expectedCpuName.isEmpty());
Assertions.assertEquals(CPU.host().name(), expectedCpuName);
Set<String> allowedCpus = Set.of(expectedCpuName.split(","));
Assertions.assertTrue(allowedCpus.contains(CPU.host().name()));
}
}

0 comments on commit eae407f

Please sign in to comment.