Skip to content

Commit 63b06e1

Browse files
committed
[GR-42435] Enable NFI tests on Windows
PullRequest: graal/13142
2 parents f5787c6 + b88a31f commit 63b06e1

File tree

6 files changed

+64
-8
lines changed

6 files changed

+64
-8
lines changed

sulong/ci/ci.jsonnet

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ local sc = (import "ci_common/sulong-common.jsonnet");
4848

4949
sc.gate + $.sulong + sc.labsjdk_ce_17 + sc.darwin_aarch64 + sc.llvmBundled + sc.requireGMP + sc.gateTags(basicTagsNoNWCC) + { name: "gate-sulong-basic-llvm-jdk17-darwin-aarch64", timelimit: "30:00" },
5050

51-
sc.gate + $.sulong + sc.labsjdk_ce_17 + sc.windows_amd64 + sc.llvmBundled + sc.gateTags("build,sulongStandalone,interop") + { name: "gate-sulong-standalone-interop-jdk17-windows-amd64", timelimit: "30:00" },
51+
sc.gate + $.sulong + sc.labsjdk_ce_17 + sc.windows_amd64 + sc.llvmBundled + sc.gateTags("build,sulongStandalone") + { name: "gate-sulong-standalone-jdk17-windows-amd64", timelimit: "30:00" },
52+
sc.gate + $.sulong + sc.labsjdk_ce_17 + sc.windows_amd64 + sc.llvmBundled + sc.gateTags("build,sulongWinSupport") + { name: "gate-sulong-winsupport-jdk17-windows-amd64", timelimit: "30:00" },
5253
],
5354

5455
coverage_builds::

sulong/mx.sulong/mx_sulong_gate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ def _unittest(title, test_suite, tags=None, testClasses=None, unittestArgs=None,
200200
_unittest('GCC_CPP', 'SULONG_GCC_CPP_TEST_SUITE', description="GCC 5.2 test suite (C++ tests)", testClasses=['GccCppSuite'], tags=['gcc_cpp'])
201201
_unittest('GCC_Fortran', 'SULONG_GCC_FORTRAN_TEST_SUITE', description="GCC 5.2 test suite (Fortran tests)", testClasses=['GccFortranSuite'], tags=['gcc_fortran'])
202202
_unittest('Sulong', 'SULONG_STANDALONE_TEST_SUITES', description="Sulong's internal tests", testClasses='SulongSuite', tags=['sulongStandalone', 'sulongBasic'])
203-
_unittest('Interop', 'SULONG_EMBEDDED_TEST_SUITES', description="Truffle Language interoperability tests", testClasses=['com.oracle.truffle.llvm.tests.interop.'], tags=['interop', 'sulongBasic'])
204-
_unittest('SulongNFI', 'SULONG_NFI_TESTS', description="Truffle NFI test suite with the Sulong NFI backend", testClasses=['com.oracle.truffle.nfi.test'], tags=['sulongNFI', 'sulongBasic'],
203+
_unittest('Interop', 'SULONG_EMBEDDED_TEST_SUITES', description="Truffle Language interoperability tests", testClasses=['com.oracle.truffle.llvm.tests.interop.'], tags=['interop', 'sulongBasic', 'sulongWinSupport'])
204+
_unittest('SulongNFI', 'SULONG_NFI_TESTS', description="Truffle NFI test suite with the Sulong NFI backend", testClasses=['com.oracle.truffle.nfi.test'], tags=['sulongNFI', 'sulongBasic', 'sulongWinSupport'],
205205
extraUnittestArgs=['-Dnative.test.backend=llvm', '-Dnative.test.path.llvm=<path:SULONG_NFI_TESTS>'])
206206
_unittest('Linker', 'SULONG_EMBEDDED_TEST_SUITES', description=None, testClasses=['com.oracle.truffle.llvm.tests.linker.'], tags=['linker', 'sulongBasic'])
207207
_unittest('Debug', 'SULONG_EMBEDDED_TEST_SUITES', description="Debug support test suite", testClasses=['com.oracle.truffle.llvm.tests.debug.LLVMDebugTest'], tags=['debug', 'sulongBasic'])

sulong/mx.sulong/mx_sulong_suite_constituents.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ def _quote_windows(arg):
374374
return '"{}"'.format(arg)
375375

376376

377+
def _ninja_escape_string(val):
378+
return val.replace(':', '$:')
379+
377380
class BootstrapToolchainLauncherBuildTask(mx.BuildTask):
378381
def __str__(self):
379382
return "Generating " + self.subject.name
@@ -440,10 +443,10 @@ def ninja_toolchain_contents(self):
440443
CXX = {CXX}
441444
AR = {AR}
442445
443-
""".format(gcc_toolchain=os.path.join(gcc_ninja_toolchain.get_output(), 'toolchain.ninja'),
444-
CC=self.subject.suite.toolchain.get_toolchain_tool('CC'),
445-
CXX=self.subject.suite.toolchain.get_toolchain_tool('CXX'),
446-
AR=self.subject.suite.toolchain.get_toolchain_tool('AR'))
446+
""".format(gcc_toolchain=_ninja_escape_string(os.path.join(gcc_ninja_toolchain.get_output(), 'toolchain.ninja')),
447+
CC=_ninja_escape_string(self.subject.suite.toolchain.get_toolchain_tool('CC')),
448+
CXX=_ninja_escape_string(self.subject.suite.toolchain.get_toolchain_tool('CXX')),
449+
AR=_ninja_escape_string(self.subject.suite.toolchain.get_toolchain_tool('AR')))
447450

448451

449452
class AbstractSulongNativeProject(mx.NativeProject): # pylint: disable=too-many-ancestors

sulong/mx.sulong/suite.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@
407407
"testProject" : True,
408408
"defaultBuild" : False,
409409
"jacoco" : "exclude",
410+
"os_arch" : {
411+
"windows" : {
412+
"<others>" : {
413+
"ldflags" : ["-shared"]
414+
},
415+
},
416+
"<others>" : {"<others" : {}},
417+
},
410418
},
411419

412420
"com.oracle.truffle.llvm.nfi.test.native.isolation" : {
@@ -421,6 +429,14 @@
421429
"testProject" : True,
422430
"defaultBuild" : False,
423431
"jacoco" : "exclude",
432+
"os_arch" : {
433+
"windows" : {
434+
"<others>" : {
435+
"ldflags" : ["-shared"]
436+
},
437+
},
438+
"<others>" : {"<others" : {}},
439+
},
424440
},
425441

426442
"com.oracle.truffle.llvm.nativemode" : {

sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/LLVMDebugPointer.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
import com.oracle.truffle.llvm.runtime.nodes.memory.load.LLVMI64LoadNodeGen.LLVMI64OffsetLoadNodeGen;
3737
import com.oracle.truffle.llvm.runtime.nodes.memory.load.LLVMI8LoadNodeGen.LLVMI8OffsetLoadNodeGen;
3838
import com.oracle.truffle.llvm.runtime.nodes.memory.load.LLVMPointerLoadNodeGen.LLVMPointerOffsetLoadNodeGen;
39+
import com.oracle.truffle.llvm.runtime.nodes.memory.store.LLVMI16StoreNodeGen.LLVMI16OffsetStoreNodeGen;
40+
import com.oracle.truffle.llvm.runtime.nodes.memory.store.LLVMI32StoreNodeGen.LLVMI32OffsetStoreNodeGen;
41+
import com.oracle.truffle.llvm.runtime.nodes.memory.store.LLVMI64StoreNodeGen.LLVMI64OffsetStoreNodeGen;
42+
import com.oracle.truffle.llvm.runtime.nodes.memory.store.LLVMI8StoreNodeGen.LLVMI8OffsetStoreNodeGen;
3943
import com.oracle.truffle.llvm.runtime.pointer.LLVMNativePointer;
4044
import com.oracle.truffle.llvm.runtime.pointer.LLVMPointer;
4145

@@ -106,6 +110,38 @@ public long readI64(long offset) throws UnexpectedResultException {
106110
return LLVMI64OffsetLoadNodeGen.getUncached().executeWithTarget(pointer, offset);
107111
}
108112

113+
public void writeI8(long offset, byte value) {
114+
LLVMI8OffsetStoreNodeGen.getUncached().executeWithTarget(pointer, offset, value);
115+
}
116+
117+
public void writeI8(byte value) {
118+
writeI8(0, value);
119+
}
120+
121+
public void writeI16(long offset, short value) {
122+
LLVMI16OffsetStoreNodeGen.getUncached().executeWithTarget(pointer, offset, value);
123+
}
124+
125+
public void writeI16(short value) {
126+
writeI16(0, value);
127+
}
128+
129+
public void writeI32(long offset, int value) {
130+
LLVMI32OffsetStoreNodeGen.getUncached().executeWithTarget(pointer, offset, value);
131+
}
132+
133+
public void writeI32(int value) {
134+
writeI32(0, value);
135+
}
136+
137+
public void writeI64(long offset, long value) {
138+
LLVMI64OffsetStoreNodeGen.getUncached().executeWithTarget(pointer, offset, value);
139+
}
140+
141+
public void writeI64(long value) {
142+
writeI64(0, value);
143+
}
144+
109145
public LLVMPointer readPointer() {
110146
return readPointer(0);
111147
}

truffle/src/com.oracle.truffle.nfi.native/src/lookup_win32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ JNIEXPORT jlong JNICALL Java_com_oracle_truffle_nfi_backend_libffi_LibFFIContext
102102
}
103103
(*env)->ReleaseStringUTFChars(env, name, utfName);
104104

105-
return (jlong) ret;
105+
return (jlong) (intptr_t) check_intrinsify(ctx, ret);
106106
}
107107

108108
#endif

0 commit comments

Comments
 (0)