Skip to content

Commit

Permalink
Merge pull request #1297 from michalvavrik/feature/drop-windows-nativ…
Browse files Browse the repository at this point in the history
…e-race-debug-options

Drop debugging options for Windows native race
  • Loading branch information
jedla97 authored Sep 10, 2024
2 parents 855fe3c + bda3ec9 commit 2a47f91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ jobs:
- name: Build in Native mode
shell: bash
run: |
mvn -B --no-transfer-progress -fae -s .github/mvn-settings.xml clean install -Pframework,examples,native -Dquarkus.native.container-build=false -Dquarkus.platform.version="${{ matrix.quarkus-version }}" -Denable-win-race-debug=true
mvn -B --no-transfer-progress -fae -s .github/mvn-settings.xml clean install -Pframework,examples,native -Dquarkus.native.container-build=false -Dquarkus.platform.version="${{ matrix.quarkus-version }}"
- name: Zip Artifacts
shell: bash
if: failure()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
import static io.quarkus.test.utils.FileUtils.findTargetFile;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.IOException;
import java.lang.annotation.Annotation;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Optional;
import java.util.ServiceLoader;

import org.jboss.logging.Logger;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.exporter.ExplodedExporter;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.condition.OS;

import io.quarkus.bootstrap.app.AugmentAction;
import io.quarkus.bootstrap.app.AugmentResult;
Expand All @@ -25,18 +22,17 @@
import io.quarkus.test.bootstrap.ManagedResource;
import io.quarkus.test.bootstrap.ServiceContext;
import io.quarkus.test.common.PathTestHelper;
import io.quarkus.test.logging.Log;
import io.quarkus.test.security.certificate.CertificateBuilder;
import io.quarkus.test.services.QuarkusApplication;
import io.quarkus.test.services.quarkus.model.QuarkusProperties;
import io.quarkus.test.utils.Command;

public class ProdQuarkusApplicationManagedResourceBuilder extends ArtifactQuarkusApplicationManagedResourceBuilder {

static final String NATIVE_RUNNER = "-runner";
static final String EXE = ".exe";
static final String TARGET = "target";

private static final Logger LOG = Logger.getLogger(ProdQuarkusApplicationManagedResourceBuilder.class.getName());
private static final String JVM_RUNNER = "-runner.jar";
private static final String QUARKUS_APP = "quarkus-app";
private static final String QUARKUS_RUN = "quarkus-run.jar";
Expand Down Expand Up @@ -87,34 +83,12 @@ public void build() {
managedResource.onPreBuild();
copyResourcesToAppFolder();
if (managedResource.needsBuildArtifact()) {
try {
this.artifact = tryToReuseOrBuildArtifact();
} catch (Throwable t) {
debugFileAccessRaceOnWindows();
throw t;
}
this.artifact = tryToReuseOrBuildArtifact();
}

managedResource.onPostBuild();
}

private void debugFileAccessRaceOnWindows() {
if (OS.current() == OS.WINDOWS && Boolean.getBoolean("enable-win-race-debug")) {
LOG.info("List all running processes:");
ProcessHandle.allProcesses().forEach(processHandle -> {
LOG.infof("pid - '%s', is alive - '%b', command - '%s', arguments - '%s'", processHandle.pid(),
processHandle.isAlive(), processHandle.info().command().orElse(""),
processHandle.info().arguments());
});
LOG.info("Print all file open handles:");
try {
new Command(".\\handle.exe -accepteula").onDirectory(Path.of(System.getenv("GITHUB_WORKSPACE"))).runAndWait();
} catch (IOException | InterruptedException e) {
throw new RuntimeException("Failed to run 'handle.exe': " + e.getMessage());
}
}
}

protected QuarkusManagedResource findManagedResource() {
for (QuarkusApplicationManagedResourceBinding binding : managedResourceBindingsRegistry) {
if (binding.appliesFor(getContext())) {
Expand Down Expand Up @@ -158,7 +132,7 @@ private Path buildArtifact() {
return new QuarkusMavenPluginBuildHelper(this, getTargetFolderForLocalArtifacts())
.buildNativeExecutable()
.orElseGet(() -> {
LOG.warn("""
Log.warn("""
Quarkus Maven plugin is missing, falling back to Quarkus bootstrap strategy.
Please add 'quarkus-maven-plugin' to your project as the bootstrap strategy will be removed
in the future.
Expand Down

0 comments on commit 2a47f91

Please sign in to comment.