< prev index next > test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/MainModuleOnly.java
Print this page
/*
! * Copyright (c) 2019, 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
/*
! * Copyright (c) 2019, 2026, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
});
! boolean skippedTest = false;
! if (!Compiler.isGraalEnabled()) {
! // run with the archive with the --limit-modules option.
! // CDS will be disabled with this options and the main class will be
! // loaded from the modular jar.
! run(topArchiveName,
! "-Xlog:cds+dynamic=debug,cds=debug,class+load=trace",
! "-cp", destJar.toString(),
! "--limit-modules", "java.base," + TEST_MODULE1,
! "--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1)
! .assertSilentlyDisabledCDS(out -> {
! out.shouldHaveExitValue(0)
! .shouldMatch("CDS is disabled when the.*option is specified")
- .shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
- });
- } else {
- skippedTest = true;
- }
// run with the archive with the --patch-module option.
// CDS will be disabled with this options and the main class will be
// loaded from the modular jar.
run(topArchiveName,
"-Xlog:cds+dynamic=debug,cds=debug,class+load=trace",
out.shouldHaveExitValue(0)
.shouldMatch("CDS is disabled when the.*option is specified")
.shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
});
! // run with the archive with the --limit-modules option.
! // CDS will be disabled with this options and the main class will be
! // loaded from the modular jar.
! run(topArchiveName,
! "-Xlog:cds+dynamic=debug,cds=debug,class+load=trace",
! "-cp", destJar.toString(),
! "--limit-modules", "java.base," + TEST_MODULE1,
! "--module-path", moduleDir.toString(),
! "-m", TEST_MODULE1)
! .assertSilentlyDisabledCDS(out -> {
! out.shouldHaveExitValue(0)
! .shouldMatch("CDS is disabled when the.*option is specified")
! .shouldMatch(".class.load. com.simple.Main source:.*com.simple.jar");
! });
// run with the archive with the --patch-module option.
// CDS will be disabled with this options and the main class will be
// loaded from the modular jar.
run(topArchiveName,
"-Xlog:cds+dynamic=debug,cds=debug,class+load=trace",
"--module-path", longDirJar.toString(),
"-m", TEST_MODULE1)
.ifAbnormalExit(output -> {
output.shouldMatch("os::stat error.*CDS dump aborted");
});
-
- if (skippedTest) {
- throw new SkippedException("Skipped --limit-modules test; it can't be run with Graal enabled");
- }
}
}
< prev index next >