summaryrefslogtreecommitdiff
path: root/tests/diagnostics/command-line
diff options
context:
space:
mode:
Diffstat (limited to 'tests/diagnostics/command-line')
-rw-r--r--tests/diagnostics/command-line/duplicate-output.slang3
-rw-r--r--tests/diagnostics/command-line/duplicate-output.slang.expected6
-rw-r--r--tests/diagnostics/command-line/duplicate-target.slang3
-rw-r--r--tests/diagnostics/command-line/duplicate-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-conflicting-stage.slang5
-rw-r--r--tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-redundant-stage.slang5
-rw-r--r--tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected6
-rw-r--r--tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert3
-rw-r--r--tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected7
-rw-r--r--tests/diagnostics/command-line/option-missing-argument.slang7
-rw-r--r--tests/diagnostics/command-line/option-missing-argument.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/option-missing-argument.slang.expected6
-rw-r--r--tests/diagnostics/command-line/output-no-entry-point.slang3
-rw-r--r--tests/diagnostics/command-line/output-no-entry-point.slang.expected6
-rw-r--r--tests/diagnostics/command-line/output-no-target.slang3
-rw-r--r--tests/diagnostics/command-line/output-no-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/pass-through-no-stage.hlsl8
-rw-r--r--tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected6
-rw-r--r--tests/diagnostics/command-line/profile-ignored.slang14
-rw-r--r--tests/diagnostics/command-line/profile-ignored.slang.1.expected6
-rw-r--r--tests/diagnostics/command-line/profile-ignored.slang.expected6
-rw-r--r--tests/diagnostics/command-line/stage-ignored.slang9
-rw-r--r--tests/diagnostics/command-line/stage-ignored.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-codegen-target.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-codegen-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-line-directive-mode.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-option.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-option.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-output-format.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-output-format.slang.expected7
-rw-r--r--tests/diagnostics/command-line/unknown-pass-through-target.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-pass-through-target.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-profile.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-profile.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-source-language.slang5
-rw-r--r--tests/diagnostics/command-line/unknown-source-language.slang.expected6
-rw-r--r--tests/diagnostics/command-line/unknown-stage.slang3
-rw-r--r--tests/diagnostics/command-line/unknown-stage.slang.expected6
42 files changed, 229 insertions, 0 deletions
diff --git a/tests/diagnostics/command-line/duplicate-output.slang b/tests/diagnostics/command-line/duplicate-output.slang
new file mode 100644
index 000000000..794a8717b
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-output.slang
@@ -0,0 +1,3 @@
+// duplicate-output.slang
+
+//TEST:SIMPLE:-entry main -stage compute -o myKernel.dxbc -o myKernel.dxbc
diff --git a/tests/diagnostics/command-line/duplicate-output.slang.expected b/tests/diagnostics/command-line/duplicate-output.slang.expected
new file mode 100644
index 000000000..23e62357f
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-output.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 80: multiple output paths have been specified entry point 'main' on target 'dxbc'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/duplicate-target.slang b/tests/diagnostics/command-line/duplicate-target.slang
new file mode 100644
index 000000000..44bbc62c7
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-target.slang
@@ -0,0 +1,3 @@
+// duplicate-target.slang
+
+//TEST:SIMPLE:-target hlsl -target hlsl
diff --git a/tests/diagnostics/command-line/duplicate-target.slang.expected b/tests/diagnostics/command-line/duplicate-target.slang.expected
new file mode 100644
index 000000000..4b8a19b2f
--- /dev/null
+++ b/tests/diagnostics/command-line/duplicate-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 50: the target 'hlsl' has been specified more than once
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-conflicting-stage.slang b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang
new file mode 100644
index 000000000..89cf5cba0
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang
@@ -0,0 +1,5 @@
+// entry-point-conflicting-stage.slang
+
+//TEST:SIMPLE:-stage vertex -stage fragment
+
+//TEST:SIMPLE:-entry vsMain -stage compute -stage vertex
diff --git a/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected
new file mode 100644
index 000000000..2f2e70b4b
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 31: conflicting stages have been specified for entry point 'vsMain'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected
new file mode 100644
index 000000000..2b3adab6b
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-conflicting-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 31: conflicting stages have been specified for entry point 'main'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-redundant-stage.slang b/tests/diagnostics/command-line/entry-point-redundant-stage.slang
new file mode 100644
index 000000000..903d696c7
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-redundant-stage.slang
@@ -0,0 +1,5 @@
+// entry-point-redundant-stage.slang
+
+//TEST:SIMPLE:-stage vertex -stage vertex
+
+//TEST:SIMPLE:-entry vsMain -stage vertex -stage vertex
diff --git a/tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected
new file mode 100644
index 000000000..36674b409
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 30: the stage 'vertex' was specified more than once for entry point 'vsMain'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected
new file mode 100644
index 000000000..e5a66e0fd
--- /dev/null
+++ b/tests/diagnostics/command-line/entry-point-redundant-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 30: the stage 'vertex' was specified more than once for entry point 'main'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert
new file mode 100644
index 000000000..0ea731470
--- /dev/null
+++ b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert
@@ -0,0 +1,3 @@
+// explicit-implicit-stage-mismatch.vert
+
+//TEST:SIMPLE:-stage fragment
diff --git a/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected
new file mode 100644
index 000000000..fef4b78de
--- /dev/null
+++ b/tests/diagnostics/command-line/explicit-implicit-stage-mismatch.vert.expected
@@ -0,0 +1,7 @@
+result code = -1
+standard error = {
+(0): warning 32: the stage specified for entry point 'main' ('pixel') does not match the stage implied by the source file name ('vertex')
+(0): error 11: the Slang compiler does not support GLSL as a source language
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/option-missing-argument.slang b/tests/diagnostics/command-line/option-missing-argument.slang
new file mode 100644
index 000000000..e62b37ba6
--- /dev/null
+++ b/tests/diagnostics/command-line/option-missing-argument.slang
@@ -0,0 +1,7 @@
+// option-missing-argument.slang
+
+// Missing argument for an option:
+
+//TEST:SIMPLE:-target -profile ps_4_0
+
+//TEST:SIMPLE:-profile ps_4_0 -target
diff --git a/tests/diagnostics/command-line/option-missing-argument.slang.1.expected b/tests/diagnostics/command-line/option-missing-argument.slang.1.expected
new file mode 100644
index 000000000..81ab1c485
--- /dev/null
+++ b/tests/diagnostics/command-line/option-missing-argument.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 21: expected an argument for command-line option '-target'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/option-missing-argument.slang.expected b/tests/diagnostics/command-line/option-missing-argument.slang.expected
new file mode 100644
index 000000000..fde023ddd
--- /dev/null
+++ b/tests/diagnostics/command-line/option-missing-argument.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 13: unknown code generation target '-profile'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/output-no-entry-point.slang b/tests/diagnostics/command-line/output-no-entry-point.slang
new file mode 100644
index 000000000..869dcabc4
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-entry-point.slang
@@ -0,0 +1,3 @@
+// output-no-entry-point.slang
+
+//TEST:SIMPLE:-o something.dxbc -entry vsMain -stage vertex -entry fsMain -stage fragment
diff --git a/tests/diagnostics/command-line/output-no-entry-point.slang.expected b/tests/diagnostics/command-line/output-no-entry-point.slang.expected
new file mode 100644
index 000000000..d04fa06f0
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-entry-point.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 70: the output path 'something.dxbc' is not associated with any entry point; a '-o' option for a compiled kernel must follow the '-entry' option for its corresponding entry point
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/output-no-target.slang b/tests/diagnostics/command-line/output-no-target.slang
new file mode 100644
index 000000000..32921a8f0
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-target.slang
@@ -0,0 +1,3 @@
+// output-no-target.slang
+
+//TEST:SIMPLE:-target dxbc -target spirv -entry main -stage compute -o bad.hlsl
diff --git a/tests/diagnostics/command-line/output-no-target.slang.expected b/tests/diagnostics/command-line/output-no-target.slang.expected
new file mode 100644
index 000000000..828c91953
--- /dev/null
+++ b/tests/diagnostics/command-line/output-no-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 61: no specified '-target' option matches the output path 'bad.hlsl', which implies the 'hlsl' format
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/pass-through-no-stage.hlsl b/tests/diagnostics/command-line/pass-through-no-stage.hlsl
new file mode 100644
index 000000000..eabdadf10
--- /dev/null
+++ b/tests/diagnostics/command-line/pass-through-no-stage.hlsl
@@ -0,0 +1,8 @@
+// pass-through-no-stage.hlsl
+
+// Trying to compile in `-pass-through` mode without
+// specifying a stage is an error, because the downstream
+// compilers don't support inferring the stage from
+// an attribute.
+
+//TEST:SIMPLE:-pass-through fxc -entry main
diff --git a/tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected b/tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected
new file mode 100644
index 000000000..87cdbbbb2
--- /dev/null
+++ b/tests/diagnostics/command-line/pass-through-no-stage.hlsl.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 35: no stage was specified for entry point 'main'; when using the '-pass-through' option, stages must be fully specified on the command line
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/profile-ignored.slang b/tests/diagnostics/command-line/profile-ignored.slang
new file mode 100644
index 000000000..8a6590690
--- /dev/null
+++ b/tests/diagnostics/command-line/profile-ignored.slang
@@ -0,0 +1,14 @@
+// profile-ignored.slang
+
+// Cases where a `-profile` option gets ignored
+// because it doesn't apply to any target
+
+// Case 1: multiple (conflicting) profiles, so we can't infer a single stage
+//
+//TEST:SIMPLE:-profile sm_5_0 -profile glsl_450
+
+
+// Case 2: a `-profile` option before any `-target`, possibly because
+// the user is specifying things in the wrong order.
+//
+//TEST:SIMPLE:-profile sm_5_0 -target dxbc -profile glsl_450 -target spirv
diff --git a/tests/diagnostics/command-line/profile-ignored.slang.1.expected b/tests/diagnostics/command-line/profile-ignored.slang.1.expected
new file mode 100644
index 000000000..eeaf701c8
--- /dev/null
+++ b/tests/diagnostics/command-line/profile-ignored.slang.1.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 43: when using multiple targets, any '-profile' option must follow the '-target' it applies to
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/profile-ignored.slang.expected b/tests/diagnostics/command-line/profile-ignored.slang.expected
new file mode 100644
index 000000000..f3290a362
--- /dev/null
+++ b/tests/diagnostics/command-line/profile-ignored.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 42: a '-profile' option was specified, but no target was specified with '-target'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/stage-ignored.slang b/tests/diagnostics/command-line/stage-ignored.slang
new file mode 100644
index 000000000..6d28c52bc
--- /dev/null
+++ b/tests/diagnostics/command-line/stage-ignored.slang
@@ -0,0 +1,9 @@
+// stage-ignored.slang
+
+// Cases where a `-stage` option gets ignored
+// because it doesn't apply to any entry point.
+
+// A `-stage` option before any `-entry`, possibly because
+// the user is specifying things in the wrong order.
+//
+//TEST:SIMPLE:-stage vertex -entry vsMain -stage fragment -entry psMain
diff --git a/tests/diagnostics/command-line/stage-ignored.slang.expected b/tests/diagnostics/command-line/stage-ignored.slang.expected
new file mode 100644
index 000000000..725e526fd
--- /dev/null
+++ b/tests/diagnostics/command-line/stage-ignored.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 34: when compiling multiple entry points, any '-stage' options must follow the '-entry' option that they apply to
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-codegen-target.slang b/tests/diagnostics/command-line/unknown-codegen-target.slang
new file mode 100644
index 000000000..57015601d
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-codegen-target.slang
@@ -0,0 +1,3 @@
+// unknown-codegen-target.slang
+
+//TEST:SIMPLE:-target z80
diff --git a/tests/diagnostics/command-line/unknown-codegen-target.slang.expected b/tests/diagnostics/command-line/unknown-codegen-target.slang.expected
new file mode 100644
index 000000000..0db8d267a
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-codegen-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 13: unknown code generation target 'z80'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-line-directive-mode.slang b/tests/diagnostics/command-line/unknown-line-directive-mode.slang
new file mode 100644
index 000000000..7e61df3f9
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-line-directive-mode.slang
@@ -0,0 +1,3 @@
+// unknown-line-directive-mode.slang
+
+//TEST:SIMPLE:-line-directive-mode quizzical
diff --git a/tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected b/tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected
new file mode 100644
index 000000000..3451d191b
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-line-directive-mode.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 24: unknown '#line' directive mode 'quizzical'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-option.slang b/tests/diagnostics/command-line/unknown-option.slang
new file mode 100644
index 000000000..52320d758
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-option.slang
@@ -0,0 +1,3 @@
+// unknown-option.slang
+
+//TEST:SIMPLE:-destroy-all-humans
diff --git a/tests/diagnostics/command-line/unknown-option.slang.expected b/tests/diagnostics/command-line/unknown-option.slang.expected
new file mode 100644
index 000000000..a74219699
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-option.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 17: unknown command-line option '-destroy-all-humans'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-output-format.slang b/tests/diagnostics/command-line/unknown-output-format.slang
new file mode 100644
index 000000000..05f59022b
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-output-format.slang
@@ -0,0 +1,3 @@
+// unknown-output-format.slang
+
+//TEST:SIMPLE:-o cookies.jar
diff --git a/tests/diagnostics/command-line/unknown-output-format.slang.expected b/tests/diagnostics/command-line/unknown-output-format.slang.expected
new file mode 100644
index 000000000..c2f41fa71
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-output-format.slang.expected
@@ -0,0 +1,7 @@
+result code = 1
+standard error = {
+(0): error 60: cannot infer an output format from the output path 'cookies.jar'
+(0): error 70: the output path 'cookies.jar' is not associated with any entry point; a '-o' option for a compiled kernel must follow the '-entry' option for its corresponding entry point
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-pass-through-target.slang b/tests/diagnostics/command-line/unknown-pass-through-target.slang
new file mode 100644
index 000000000..7b86f62d6
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-pass-through-target.slang
@@ -0,0 +1,3 @@
+// unknown-pass-through-target.slang
+
+//TEST:SIMPLE:-pass-through subcon
diff --git a/tests/diagnostics/command-line/unknown-pass-through-target.slang.expected b/tests/diagnostics/command-line/unknown-pass-through-target.slang.expected
new file mode 100644
index 000000000..0c4b1aa4d
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-pass-through-target.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 16: unknown pass-through target 'subcon'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-profile.slang b/tests/diagnostics/command-line/unknown-profile.slang
new file mode 100644
index 000000000..f96363058
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-profile.slang
@@ -0,0 +1,3 @@
+// unknown-profile.slang
+
+//TEST:SIMPLE:-profile thunder_kiss_65
diff --git a/tests/diagnostics/command-line/unknown-profile.slang.expected b/tests/diagnostics/command-line/unknown-profile.slang.expected
new file mode 100644
index 000000000..7e53303fc
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-profile.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 14: unknown profile 'thunder_kiss_65'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-source-language.slang b/tests/diagnostics/command-line/unknown-source-language.slang
new file mode 100644
index 000000000..c39a3ae4f
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-source-language.slang
@@ -0,0 +1,5 @@
+// unknown-source-language.slang
+
+// Unknown source file extension (can't deduce language)
+
+//TEST:SIMPLE:batmobile.car
diff --git a/tests/diagnostics/command-line/unknown-source-language.slang.expected b/tests/diagnostics/command-line/unknown-source-language.slang.expected
new file mode 100644
index 000000000..6d596ffab
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-source-language.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 12: can't deduce language for input file 'batmobile.car'
+}
+standard output = {
+}
diff --git a/tests/diagnostics/command-line/unknown-stage.slang b/tests/diagnostics/command-line/unknown-stage.slang
new file mode 100644
index 000000000..1645e5998
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-stage.slang
@@ -0,0 +1,3 @@
+// unknown-stage.slang
+
+//TEST:SIMPLE:-stage green_hills_zone
diff --git a/tests/diagnostics/command-line/unknown-stage.slang.expected b/tests/diagnostics/command-line/unknown-stage.slang.expected
new file mode 100644
index 000000000..4d00e6ff4
--- /dev/null
+++ b/tests/diagnostics/command-line/unknown-stage.slang.expected
@@ -0,0 +1,6 @@
+result code = 1
+standard error = {
+(0): error 15: unknown stage 'green_hills_zone'
+}
+standard output = {
+}