Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
fc368a8
Dedicated directory with manual BCI unit test tags
steve-s Dec 1, 2025
7ee0bcd
Make Bytecode DSL the default
steve-s Nov 28, 2025
f494ee7
Ignore test_print_exception_gh_102056
steve-s Dec 3, 2025
b1b6d6a
Adapt test_sys_settrace to new test utils
steve-s Dec 3, 2025
b9be23b
Fix assertion 'every bytecode range should have been converted' in co…
steve-s Dec 3, 2025
7ad7ac4
Ignore stack size stability tests, issue: GR-64479
steve-s Dec 3, 2025
8cd7a40
Ignore test_next_until_return_in_generator, issue: GR-71863
steve-s Dec 3, 2025
78ac8a5
Ignore test_sys_settrace tests that give wrong return statement line,…
steve-s Dec 3, 2025
3651170
Ignore tests in test_sys_setprofile and test_trace, issue GR-71865
steve-s Dec 3, 2025
537852b
Ignore few more tagged tests, issues: GR-71869, GR-71867, GR-71866
steve-s Dec 3, 2025
ba92e2a
Ignore two tests in test_syntax, issue GR-71364
steve-s Dec 3, 2025
4785ca6
Trash temporary locals after destructive assignment to pass test_call…
steve-s Dec 4, 2025
15166b2
Ignore TestExpressionStackSize.test_if_else, issue GR-64307
steve-s Dec 4, 2025
2fb4b56
Ignore test_type_annotations.test_match, issue: GR-71365
steve-s Dec 4, 2025
fd48d3f
Ignore few tests in test_inspect, issue: GR-71889
steve-s Dec 5, 2025
5146bbf
Ignore GC tests in test_memoryio, issue: GR-71890
steve-s Dec 5, 2025
a2c9fe4
Ignore test_descr:test_remove_subclass, issue: GR-71917
steve-s Dec 5, 2025
82e6c63
Ignore few test_(c)profile tests, issue: GR-71916
steve-s Dec 5, 2025
ec4190e
Ignore few tests in test_pdb, issue: GR-71918
steve-s Dec 5, 2025
5f3d39f
Ignore HPy test_HPyErr_WarnEx, issue GR-71943
steve-s Dec 9, 2025
67a3f06
Properly disable PythonDebugTest on Bytecode DSL, issue GR-71618
steve-s Dec 9, 2025
587ace5
Fix graalpy-extensions deployment
steve-s Dec 10, 2025
b12ffbe
Fix PythonContext leak through bytecode parser
steve-s Dec 10, 2025
04167a2
Remove Bytecode DSL handling in fork_exec to fix pip installation in …
steve-s Dec 11, 2025
7b244ab
Run TCK without VerifierInstrument, issue GR-71979
steve-s Dec 12, 2025
d796222
Remove Bytecode DSL config from benchmarks
steve-s Dec 12, 2025
08772cd
Workaround Gradle failure in CI
steve-s Dec 12, 2025
4a0e3ce
Fix java_args overriding in mx_graalpython
steve-s Dec 12, 2025
37d685d
Bytecode DSL fix: last expr statement in module is return value for i…
steve-s Dec 15, 2025
420fba6
Do not re-acquire intentionally released GIL in TopLevelExceptionHand…
steve-s Dec 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 19 additions & 18 deletions ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,17 @@
local bench_task(bench=null, benchmarks=BENCHMARKS) = super.bench_task(bench=bench, benchmarks=benchmarks),
local bisect_bench_task = self.bisect_bench_task,

local bytecode_dsl_env = task_spec({
// Manual interpreter variants (DSL disabled)
local manual_interpreter_env = task_spec({
environment +: {
BYTECODE_DSL_INTERPRETER: "true"
BYTECODE_DSL_INTERPRETER: "false"
},
}),
local bytecode_dsl_gate(name) = bytecode_dsl_env + task_spec({
local manual_interpreter_gate(name) = manual_interpreter_env + task_spec({
tags :: name,
}),
local bytecode_dsl_bench = bytecode_dsl_env + task_spec({
name_suffix +:: ["bytecode-dsl"],
local manual_interpreter_bench = manual_interpreter_env + task_spec({
name_suffix +:: ["manual-interpreter"],
}),

// -----------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -116,7 +117,7 @@
"darwin:aarch64:jdk-latest" : tier3 + provide(GPY_JVM_STANDALONE),
"windows:amd64:jdk-latest" : tier3 + provide(GPY_JVM_STANDALONE),
}),
"python-unittest-bytecode-dsl": gpgate + platform_spec(no_jobs) + bytecode_dsl_gate("python-unittest") + platform_spec({
"python-unittest-manual-interpreter": gpgate + platform_spec(no_jobs) + manual_interpreter_gate("python-unittest") + platform_spec({
"linux:amd64:jdk-latest" : daily + t("01:00:00"),
"linux:aarch64:jdk-latest" : daily + t("01:00:00"),
"darwin:aarch64:jdk-latest" : daily + t("01:00:00"),
Expand Down Expand Up @@ -170,7 +171,7 @@
"darwin:aarch64:jdk-latest" : tier3 + require(GRAAL_JDK_LATEST),
"windows:amd64:jdk-latest" : tier3 + require(GRAAL_JDK_LATEST),
}),
"python-junit-bytecode-dsl": gpgate + platform_spec(no_jobs) + bytecode_dsl_gate("python-junit") + platform_spec({
"python-junit-manual-interpreter": gpgate + platform_spec(no_jobs) + manual_interpreter_gate("python-junit") + platform_spec({
"linux:amd64:jdk-latest" : tier3 + require(GRAAL_JDK_LATEST),
}),
"python-junit-maven": gpgate_maven + platform_spec(no_jobs) + platform_spec({
Expand Down Expand Up @@ -204,12 +205,12 @@
],
}),
}),
"python-pgo-profile-bytecode-dsl": gpgate_ee + bytecode_dsl_env + platform_spec(no_jobs) + platform_spec({
"python-pgo-profile-manual-interpreter": gpgate_ee + manual_interpreter_env + platform_spec(no_jobs) + platform_spec({
"linux:amd64:jdk-latest" : post_merge + t("01:30:00") + task_spec({
run: [["mx", "python-native-pgo"]],
logs+: [
"default-bytecode-dsl.iprof.gz",
"default-bytecode-dsl.lcov",
"default-manual-interpreter.iprof.gz",
"default-manual-interpreter.lcov",
],
}),
}),
Expand All @@ -219,7 +220,7 @@
"darwin:aarch64:jdk-latest" : tier3 + require(GPY_NATIVE_STANDALONE),
"windows:amd64:jdk-latest" : tier3 + require(GPY_NATIVE_STANDALONE) + batches(2),
}),
"python-svm-unittest-bytecode-dsl": gpgate + platform_spec(no_jobs) + bytecode_dsl_gate("python-svm-unittest") + platform_spec({
"python-svm-unittest-manual-interpreter": gpgate + platform_spec(no_jobs) + manual_interpreter_gate("python-svm-unittest") + platform_spec({
"linux:amd64:jdk-latest" : tier2 + provide(GPY_NATIVE_BYTECODE_DSL_STANDALONE),
}),
"python-tagged-unittest": gpgate + require(GPY_NATIVE_STANDALONE) + batches(TAGGED_UNITTESTS_SPLIT) + platform_spec(no_jobs) + platform_spec({
Expand All @@ -228,7 +229,7 @@
"darwin:aarch64:jdk-latest" : tier3,
"windows:amd64:jdk-latest" : daily + t("02:00:00"),
}),
"python-tagged-unittest-bytecode-dsl": gpgate + require(GPY_NATIVE_BYTECODE_DSL_STANDALONE) + batches(TAGGED_UNITTESTS_SPLIT) + bytecode_dsl_gate("python-tagged-unittest") + platform_spec(no_jobs) + platform_spec({
"python-tagged-unittest-manual-interpreter": gpgate + require(GPY_NATIVE_BYTECODE_DSL_STANDALONE) + batches(TAGGED_UNITTESTS_SPLIT) + manual_interpreter_gate("python-tagged-unittest") + platform_spec(no_jobs) + platform_spec({
"linux:amd64:jdk-latest" : tier3,
}),
"python-graalvm": gpgate + platform_spec(no_jobs) + platform_spec({
Expand Down Expand Up @@ -288,7 +289,7 @@
},

local need_pgo = task_spec({runAfter: ["python-pgo-profile-post_merge-linux-amd64-jdk-latest"]}),
local need_bc_pgo = task_spec({runAfter: ["python-pgo-profile-bytecode-dsl-post_merge-linux-amd64-jdk-latest"]}),
local need_bc_pgo = task_spec({runAfter: ["python-pgo-profile-manual-interpreter-post_merge-linux-amd64-jdk-latest"]}),
local forks_warmup = forks("./mx.graalpython/warmup-fork-counts.json"),
local forks_meso = forks("meso.json"),
local raw_results = task_spec({
Expand Down Expand Up @@ -316,7 +317,7 @@
}),
for bench in ["micro", "meso", "macro"]
} + {
[bench + "-bytecode-dsl"]: bench_task(bench) + bytecode_dsl_bench + platform_spec(no_jobs) + bench_variants({
[bench + "-manual-interpreter"]: bench_task(bench) + manual_interpreter_bench + platform_spec(no_jobs) + bench_variants({
"vm_name:graalvm_ee_default_bc_dsl" : {"linux:amd64:jdk-latest" : daily + t("08:00:00")},
"vm_name:graalpython_enterprise_bc_dsl" : {"linux:amd64:jdk-latest" : daily + t("08:00:00")},
}),
Expand Down Expand Up @@ -351,7 +352,7 @@
}),
for bench in ["micro_small", "meso_small"]
} + {
[bench + "-bytecode-dsl"]: bench_task(bench) + bytecode_dsl_bench + platform_spec(no_jobs) + bench_variants({
[bench + "-manual-interpreter"]: bench_task(bench) + manual_interpreter_bench + platform_spec(no_jobs) + bench_variants({
"vm_name:graalvm_ee_default_interpreter_bc_dsl" : {"linux:amd64:jdk-latest" : daily + t("04:00:00")},
"vm_name:graalpython_enterprise_interpreter_bc_dsl" : {"linux:amd64:jdk-latest" : weekly + t("04:00:00")},
}),
Expand Down Expand Up @@ -384,7 +385,7 @@
}),
for bench in ["warmup"]
} + {
[bench + "-bytecode-dsl"]: bench_task(bench) + bytecode_dsl_bench + platform_spec(no_jobs) + bench_variants({
[bench + "-manual-interpreter"]: bench_task(bench) + manual_interpreter_bench + platform_spec(no_jobs) + bench_variants({
"vm_name:graalvm_ee_default_bc_dsl" : {"linux:amd64:jdk-latest" : on_demand + t("05:00:00") + forks_warmup},
"vm_name:graalpython_enterprise_bc_dsl" : {"linux:amd64:jdk-latest" : on_demand + t("05:00:00") + forks_warmup},
}),
Expand All @@ -397,7 +398,7 @@
}),
for bench in ["heap", "micro_small_heap"]
} + {
[bench + "-bytecode-dsl"]: bench_task(bench) + bytecode_dsl_bench + platform_spec(no_jobs) + bench_variants({
[bench + "-manual-interpreter"]: bench_task(bench) + manual_interpreter_bench + platform_spec(no_jobs) + bench_variants({
"vm_name:graalvm_ee_default_interpreter_bc_dsl" : {"linux:amd64:jdk-latest" : post_merge + t("02:00:00") + need_bc_pgo},
"vm_name:graalpython_enterprise_interpreter_bc_dsl" : {"linux:amd64:jdk-latest" : weekly + t("02:00:00")},
}),
Expand Down Expand Up @@ -429,7 +430,7 @@
for bench in ["pyperformance"]
} + {
// Bytecode DSL benchmarks with community benchmark suites for external numbers
[bench + "-bytecode-dsl"]: bench_task(bench, PY_BENCHMARKS) + bytecode_dsl_bench + platform_spec(no_jobs) + raw_results + bench_variants({
[bench + "-manual-interpreter"]: bench_task(bench, PY_BENCHMARKS) + manual_interpreter_bench + platform_spec(no_jobs) + raw_results + bench_variants({
"vm_name:graalvm_ee_default_bc_dsl" : {"linux:amd64:jdk-latest" : weekly + t("08:00:00")},
}),
for bench in ["pyperformance"]
Expand Down
4 changes: 3 additions & 1 deletion ci/python-gate.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
windows: {
common: {
PATH: "$MAVEN_HOME\\bin;$PATH",
# Gradle: this feature doesn't work on all Windows CI machines
GRADLE_OPTS: "-Dorg.gradle.vfs.watch=false",
},
amd64: {},
aarch64: {},
Expand Down Expand Up @@ -419,7 +421,7 @@
environment+: $.environment(self.os, self.arch),
packages+: $.packages(self.os, self.arch),
run+: [
["mx"] + self.mx_parameters + self.dy + self.primary_suite + [
["mx", "--J", "@-Dtck.inlineVerifierInstrument=false"] + self.mx_parameters + self.dy + self.primary_suite + [
"--strict-compliance", "--primary", "gate", "--tags", self.tags, "-B=--force-deprecation-as-warning",
] + self.all_suites + self.gate_parameters,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,58 +43,101 @@
import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.nio.charset.Charset;
import java.util.function.Consumer;
import java.util.function.Function;

import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.PolyglotException;
import org.graalvm.polyglot.SandboxPolicy;
import org.graalvm.polyglot.Value;
import org.junit.Assume;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class SandboxPolicyUntrustedTest {
@BeforeClass
public static void setupClass() {
String requestedTest = System.getProperty("test");
Assume.assumeTrue(requestedTest != null && requestedTest.equals(SandboxPolicyUntrustedTest.class.getSimpleName()));
}

private static Value run(String source) {
public record ContextConfig(String name, Consumer<Context.Builder> config) {
@Override
public String toString() {
return name();
}
}

@Parameters(name = "{0}")
public static ContextConfig[] configs() {
return new ContextConfig[]{
new ContextConfig("UNTRUSTED", b -> b //
.sandbox(SandboxPolicy.ISOLATED) //
.option("engine.MaxIsolateMemory", "1GB")),
new ContextConfig("ISOLATED", b -> b //
.sandbox(SandboxPolicy.ISOLATED) //
.option("engine.MaxIsolateMemory", "1GB")),
new ContextConfig("CONSTRAINED", b -> b //
.sandbox(SandboxPolicy.CONSTRAINED)),
};
}

@Parameter public ContextConfig config;

private <R> R run(String source, Function<Value, R> resultFun) {
// encodings import during ctx init takes 19 frames
return run(source, 20, resultFun);
}

private <R> R run(String source, int maxStackFrames, Function<Value, R> resultFun) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
ByteArrayOutputStream errorOutput = new ByteArrayOutputStream();
try (Context context = Context.newBuilder("python") //
.sandbox(SandboxPolicy.UNTRUSTED) //
.out(output) //
.err(errorOutput) //
.option("engine.MaxIsolateMemory", "1GB") //
.option("sandbox.MaxHeapMemory", "800MB") //
.apply(config.config()).option("sandbox.MaxHeapMemory", "800MB") //
.option("sandbox.MaxCPUTime", "10s") //
.option("sandbox.MaxASTDepth", "100") //
.option("sandbox.MaxStackFrames", "10") //
.option("sandbox.MaxStackFrames", Integer.toString(maxStackFrames)) //
.option("sandbox.MaxThreads", "1") //
.option("sandbox.MaxOutputStreamSize", "1MB") //
.option("sandbox.MaxErrorStreamSize", "1MB") //
.build()) {
return context.eval("python", source);
return resultFun.apply(context.eval("python", source));
} catch (PolyglotException e) {
System.out.println("stdout:");
System.out.println(output.toString(Charset.defaultCharset()));
System.out.println("--------");
System.out.println("stderr:");
System.out.println(errorOutput.toString(Charset.defaultCharset()));
throw e;
}
}

@Test
public void helloworld() {
assertEquals("hello world", run("'hello world'").asString());
assertEquals("hello world", run("'hello world'", Value::asString));
}

@Test
public void canImportBuiltinModules() {
assertEquals("graalpy", run("import sys; sys.implementation.name").asString());
assertEquals("graalpy", run("import sys; sys.implementation.name", Value::asString));
}

@Test
public void canImportNonBuiltinModules() {
assertEquals("email", run("import email; email.__name__").asString());
assertEquals("email", run("import email; email.__name__", Value::asString));
}

@Test
public void doesNotLeakEnvironmentVariables() {
assertEquals("<empty>", run("import os; os.environ.get('JAVA_HOME', '<empty>')").asString());
int maxStackFrames = 27;
assertEquals("<empty>", run("import os; os.environ.get('JAVA_HOME', '<empty>')", maxStackFrames, Value::asString));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.Value;
import org.junit.Assert;
import org.junit.Test;

import com.oracle.graal.python.test.integration.PythonTests;
Expand All @@ -50,6 +52,12 @@ public void helloworldAgain() {
PythonTests.assertPrints("hello\n", source);
}

@Test
public void helloworldExpression() {
Value value = PythonTests.eval("'hello world'");
Assert.assertEquals("hello world", value.asString());
}

@Test
public void usesFrozenModules() {
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
Expand Down
Loading