summaryrefslogtreecommitdiffstats
path: root/tests/cpu-program
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-08-20 01:03:06 -0700
committerGitHub <noreply@github.com>2022-08-20 01:03:06 -0700
commitaf70651a4843b16dd24e14b5cedffe399ebeb862 (patch)
treea6aefd5db94a048114b9a8d7ed3f826533105fab /tests/cpu-program
parent6412c4913b6a063438bb11863f2c154d3ae42dfe (diff)
Call `gfx` in slang program. (#2370)
Diffstat (limited to 'tests/cpu-program')
-rw-r--r--tests/cpu-program/gfx-smoke.slang16
-rw-r--r--tests/cpu-program/gfx-smoke.slang.expected6
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/cpu-program/gfx-smoke.slang b/tests/cpu-program/gfx-smoke.slang
new file mode 100644
index 000000000..e04848f5d
--- /dev/null
+++ b/tests/cpu-program/gfx-smoke.slang
@@ -0,0 +1,16 @@
+//TEST:EXECUTABLE:
+__target_intrinsic(cpp, "printf(\"%s\\n\", ($0).getBuffer())")
+void writeln(String text);
+
+import gfx;
+
+public __extern_cpp int main()
+{
+ gfx.DeviceDesc deviceDesc = {};
+ deviceDesc.deviceType = gfx.DeviceType.CPU;
+ gfx.IDevice obj;
+ if (gfx.succeeded(gfx.gfxCreateDevice(&deviceDesc, obj)))
+ writeln("succ");
+ else
+ writeln("fail");
+} \ No newline at end of file
diff --git a/tests/cpu-program/gfx-smoke.slang.expected b/tests/cpu-program/gfx-smoke.slang.expected
new file mode 100644
index 000000000..981dcfc29
--- /dev/null
+++ b/tests/cpu-program/gfx-smoke.slang.expected
@@ -0,0 +1,6 @@
+result code = 0
+standard error = {
+}
+standard output = {
+succ
+}