1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

tools: add support for VSELF_SHOULD_FAIL to v self, in order to make testing all v up failure modes easier.

This commit is contained in:
Delyan Angelov 2022-11-07 12:36:30 +02:00
parent c015f15d8d
commit 5f33585edf
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -8,6 +8,12 @@ import v.util.recompilation
const is_debug = os.args.contains('-debug') const is_debug = os.args.contains('-debug')
fn main() { fn main() {
// make testing `v up` easier, by providing a way to force `v self` to fail,
// to test the fallback logic:
if os.getenv('VSELF_SHOULD_FAIL') != '' {
eprintln('v self failed')
exit(1)
}
// support a renamed `v` executable too: // support a renamed `v` executable too:
vexe := pref.vexe_path() vexe := pref.vexe_path()
vroot := os.dir(vexe) vroot := os.dir(vexe)