summaryrefslogtreecommitdiffstats
path: root/tests/serialization
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-03-27 13:57:42 -0400
committerGitHub <noreply@github.com>2023-03-27 10:57:42 -0700
commitca1f93a916ce6b984cba402c8d3710988f2b618f (patch)
treef39b638210d38efdc7e2bb746c06b881323d0f53 /tests/serialization
parent2179480e28bdd46c71cec269a8f55ba93aa54f53 (diff)
Using SourceMap for location output (#2736)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP using SourceMap with SourceManager. * Add a test to check obfuscation map is working. --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/serialization')
-rw-r--r--tests/serialization/obfuscated-check-loc.slang36
-rw-r--r--tests/serialization/obfuscated-check-loc.slang.expected6
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/serialization/obfuscated-check-loc.slang b/tests/serialization/obfuscated-check-loc.slang
new file mode 100644
index 000000000..8575a2650
--- /dev/null
+++ b/tests/serialization/obfuscated-check-loc.slang
@@ -0,0 +1,36 @@
+//TEST:SIMPLE:-target cpp -stage compute -entry computeMain -obfuscate -source-map -line-directive-mode none
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+#if 0
+[DllExport]
+String getString()
+{
+ return "Hello!";
+}
+#endif
+
+int silly(int a)
+{
+ int t = 0;
+ [ForceUnroll(10)]
+ while ( a > 0)
+ {
+ t = t + t + a;
+ }
+ return t;
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int x = int(dispatchThreadID.x);
+
+ //String v = getString();
+ int v = silly(x);
+
+ outputBuffer[x] = v;
+
+}
+
diff --git a/tests/serialization/obfuscated-check-loc.slang.expected b/tests/serialization/obfuscated-check-loc.slang.expected
new file mode 100644
index 000000000..0743b437a
--- /dev/null
+++ b/tests/serialization/obfuscated-check-loc.slang.expected
@@ -0,0 +1,6 @@
+result code = -1
+standard error = {
+tests/serialization/obfuscated-check-loc.slang(18): error 40020: loop does not terminate within the limited number of iterations, unrolling is aborted.
+}
+standard output = {
+}