Skip to content

Commit 6a7821d

Browse files
committed
[GR-34971] New FastRSession that allows sharing of one context for multiple tests.
PullRequest: fastr/2673
2 parents e52a105 + b524fa6 commit 6a7821d

37 files changed

+453
-1218
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 22.0.0
2+
* In unit tests, use single shared context rather than multiple inner contexts.
3+
14
# 21.3.0
25
* Upgrade of [PCRE](https://www.pcre.org/) to PCRE2 version 10.37.
36
* See [GNU-R changelog](https://cran.r-project.org/doc/manuals/r-devel/NEWS.html) (section MIGRATION TO PCRE2) for more details

com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public class TestBase {
4747
@BeforeClass
4848
public static void setupClass() {
4949
FastRSession session = FastRSession.create();
50-
testVMContext = session.getContext();
5150
context = session.createContext(ContextKind.SHARE_PARENT_RW);
51+
testVMContext = session.getContext();
52+
context.reset();
5253
}
5354

5455
@AfterClass

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test

Lines changed: 88 additions & 198 deletions
Large diffs are not rendered by default.

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/S4/TestS4.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public void testObjectValueSemantics() {
175175
@Test
176176
public void testActiveBindings() {
177177
assertEval("someSymbol0 <- 1; makeActiveBinding('someSymbol0', function(x) { x }, .GlobalEnv)");
178-
assertEval(Output.IgnoreErrorMessage, "lockEnvironment(.GlobalEnv); makeActiveBinding('someSymbol1', function(x) { x }, .GlobalEnv)");
178+
assertEval(Output.IgnoreErrorMessage, Context.NonShared, "lockEnvironment(.GlobalEnv); makeActiveBinding('someSymbol1', function(x) { x }, .GlobalEnv)");
179179
assertEval("makeActiveBinding('someSymbol2', function(x) { x }, .GlobalEnv); bindingIsActive('someSymbol2', .GlobalEnv)");
180180
assertEval("bindingIsActive('someSymbol3', .GlobalEnv)");
181181
assertEval(".Internal(bindingIsActive(as.name('someSymbol4'), .GlobalEnv))");

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public class TestBase {
111111
public static final Map<String, String> options = new HashMap<>();
112112

113113
/**
114-
* See {@link com.oracle.truffle.r.test.builtins.TestTestBase} for examples.
114+
* See {@code TestTestBase} for examples.
115115
*/
116116
public enum Output implements TestTrait {
117117
ImprovedErrorContext, // FastR provides a more accurate error context
@@ -554,6 +554,10 @@ protected void assertEval(long timeout, TestTrait trait1, TestTrait trait2, Stri
554554
evalAndCompare(input, timeout, trait1, trait2);
555555
}
556556

557+
protected void assertEval(long timeout, TestTrait trait1, TestTrait trait2, TestTrait trait3, String... input) {
558+
evalAndCompare(input, timeout, trait1, trait2, trait3);
559+
}
560+
557561
protected void assertEval(TestTrait trait1, TestTrait trait2, String... input) {
558562
evalAndCompare(input, USE_DEFAULT_TIMEOUT, trait1, trait2);
559563
}

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Sysgetenv.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1515
*
1616
* Copyright (c) 2012-2014, Purdue University
17-
* Copyright (c) 2013, 2020, Oracle and/or its affiliates
17+
* Copyright (c) 2013, 2021, Oracle and/or its affiliates
1818
*
1919
* All rights reserved.
2020
*/
@@ -42,7 +42,7 @@ public void testEnvVars() {
4242
assertEval("{ Sys.setenv(\"a\") } ");
4343
assertEval("{ Sys.setenv(FASTR_A=\"a\"); Sys.getenv(\"FASTR_A\"); } ");
4444
assertEval("{ Sys.setenv(FASTR_A=\"a\", FASTR_B=\"b\"); Sys.getenv(c(\"FASTR_A\", \"FASTR_B\")); } ");
45-
assertEval("{ Sys.getenv(\"FASTR_A\") } ");
46-
assertEval("{ Sys.getenv(\"FASTR_A\", unset=\"UNSET\") } ");
45+
assertEval("{ Sys.getenv(\"FASTR_SHOULD_NOT_BE_DEFINED\") } ");
46+
assertEval("{ Sys.getenv(\"FASTR_SHOULD_NOT_BE_DEFINED\", unset=\"UNSET\") } ");
4747
}
4848
}

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/channels/R/channels1.R

Lines changed: 0 additions & 35 deletions
This file was deleted.

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/channels/R/channels10.R

Lines changed: 0 additions & 36 deletions
This file was deleted.

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/channels/R/channels11.R

Lines changed: 0 additions & 36 deletions
This file was deleted.

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/channels/R/channels12.R

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)