Add some negative test coverage for malformed -Clink-self-contained flags

This commit is contained in:
Jieyou Xu
2025-05-14 17:58:00 +08:00
parent 414482f6a0
commit 3e051afec7
6 changed files with 33 additions and 0 deletions
@@ -0,0 +1,2 @@
error: incorrect value `*lld` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected
@@ -0,0 +1,2 @@
error: incorrect value `` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected
@@ -0,0 +1,23 @@
//! Check that malformed `-Clink-self-contained` invocations are properly rejected.
//@ revisions: no_value
//@[no_value] compile-flags: -Clink-self-contained=
//[no_value]~? ERROR incorrect value `` for codegen option `link-self-contained`
//@ revisions: invalid_modifier
//@[invalid_modifier] compile-flags: -Clink-self-contained=*lld
//[invalid_modifier]~? ERROR incorrect value `*lld` for codegen option `link-self-contained`
//@ revisions: unknown_value
//@[unknown_value] compile-flags: -Clink-self-contained=unknown
//[unknown_value]~? ERROR incorrect value `unknown` for codegen option `link-self-contained`
//@ revisions: unknown_modifier_value
//@[unknown_modifier_value] compile-flags: -Clink-self-contained=-unknown
//[unknown_modifier_value]~? ERROR incorrect value `-unknown` for codegen option `link-self-contained`
//@ revisions: unknown_boolean
//@[unknown_boolean] compile-flags: -Clink-self-contained=maybe
//[unknown_boolean]~? ERROR incorrect value `maybe` for codegen option `link-self-contained`
fn main() {}
@@ -0,0 +1,2 @@
error: incorrect value `maybe` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected
@@ -0,0 +1,2 @@
error: incorrect value `-unknown` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected
@@ -0,0 +1,2 @@
error: incorrect value `unknown` for codegen option `link-self-contained` - one of: `y`, `yes`, `on`, `n`, `no`, `off`, or a list of enabled (`+` prefix) and disabled (`-` prefix) components: `crto`, `libc`, `unwind`, `linker`, `sanitizers`, `mingw` was expected