mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
ompiler: MSVC related fixes and v test v
for windows testing
* MSVC related fixes and v test v for windows testing * If second stage crashes on windows goto error * use os.exec instead of system so that the error can be printed * use -debug for osx vid * Fix some whitespace to trigger a rebuild
This commit is contained in:
parent
0066afe7fc
commit
d373b331fa
@ -52,5 +52,5 @@ script:
|
|||||||
- |
|
- |
|
||||||
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||||
git clone https://github.com/vlang/vid
|
git clone https://github.com/vlang/vid
|
||||||
cd vid && ../v .
|
cd vid && ../v -debug -o vid .
|
||||||
fi
|
fi
|
||||||
|
@ -427,9 +427,14 @@ void init_consts();')
|
|||||||
}
|
}
|
||||||
// vlib can't have `init_consts()`
|
// vlib can't have `init_consts()`
|
||||||
cgen.genln('void init_consts() {
|
cgen.genln('void init_consts() {
|
||||||
#ifdef _WIN32\n _setmode(_fileno(stdout), _O_U8TEXT);
|
#ifdef _WIN32
|
||||||
|
#ifndef _BOOTSTRAP_NO_UNICODE_STREAM
|
||||||
|
_setmode(_fileno(stdout), _O_U8TEXT);
|
||||||
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_PROCESSED_OUTPUT | 0x0004);
|
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), ENABLE_PROCESSED_OUTPUT | 0x0004);
|
||||||
// ENABLE_VIRTUAL_TERMINAL_PROCESSING\n#endif\n g_str_buf=malloc(1000);
|
// ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
g_str_buf=malloc(1000);
|
||||||
$consts_init_body
|
$consts_init_body
|
||||||
}')
|
}')
|
||||||
// _STR function can't be defined in vlib
|
// _STR function can't be defined in vlib
|
||||||
@ -720,8 +725,7 @@ fn (c mut V) cc_windows_cross() {
|
|||||||
winroot_url := 'https://github.com/vlang/v/releases/download/v0.1.10/winroot.zip'
|
winroot_url := 'https://github.com/vlang/v/releases/download/v0.1.10/winroot.zip'
|
||||||
println('"$winroot" not found. Download it from $winroot_url and save in $ModPath')
|
println('"$winroot" not found. Download it from $winroot_url and save in $ModPath')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
}
|
||||||
}
|
|
||||||
mut obj_name := c.out_name
|
mut obj_name := c.out_name
|
||||||
obj_name = obj_name.replace('.exe', '')
|
obj_name = obj_name.replace('.exe', '')
|
||||||
obj_name = obj_name.replace('.o.o', '.o')
|
obj_name = obj_name.replace('.o.o', '.o')
|
||||||
@ -745,7 +749,7 @@ fn (c mut V) cc_windows_cross() {
|
|||||||
if os.system(link_cmd) != 0 {
|
if os.system(link_cmd) != 0 {
|
||||||
println('Cross compilation for Windows failed. Make sure you have lld linker installed.')
|
println('Cross compilation for Windows failed. Make sure you have lld linker installed.')
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
// os.rm(obj_name)
|
// os.rm(obj_name)
|
||||||
}
|
}
|
||||||
println('Done!')
|
println('Done!')
|
||||||
@ -1448,11 +1452,20 @@ fn update_v() {
|
|||||||
|
|
||||||
fn test_v() {
|
fn test_v() {
|
||||||
vexe := os.args[0]
|
vexe := os.args[0]
|
||||||
|
// Emily: pass args from the invocation to the test
|
||||||
|
// e.g. `v -g -os msvc test v` -> `$vexe -g -os msvc $file`
|
||||||
|
mut joined_args := os.args.right(1).join(' ')
|
||||||
|
joined_args = joined_args.left(joined_args.last_index('test'))
|
||||||
|
println('$joined_args')
|
||||||
|
|
||||||
test_files := os.walk_ext('.', '_test.v')
|
test_files := os.walk_ext('.', '_test.v')
|
||||||
for file in test_files {
|
for file in test_files {
|
||||||
print(file + ' ')
|
print(file + ' ')
|
||||||
if os.system('$vexe $file') != 0 {
|
r := os.exec('$vexe $joined_args -debug $file') or {
|
||||||
println('failed')
|
panic('failed on $file')
|
||||||
|
}
|
||||||
|
if r.exit_code != 0 {
|
||||||
|
println('failed `$file` (\n$r.output\n)')
|
||||||
exit(1)
|
exit(1)
|
||||||
} else {
|
} else {
|
||||||
println('OK')
|
println('OK')
|
||||||
@ -1462,8 +1475,11 @@ fn test_v() {
|
|||||||
examples := os.walk_ext('examples', '.v')
|
examples := os.walk_ext('examples', '.v')
|
||||||
for file in examples {
|
for file in examples {
|
||||||
print(file + ' ')
|
print(file + ' ')
|
||||||
if os.system('$vexe $file') != 0 {
|
r := os.exec('$vexe $joined_args -debug $file') or {
|
||||||
println('failed')
|
panic('failed on $file')
|
||||||
|
}
|
||||||
|
if r.exit_code != 0 {
|
||||||
|
println('failed `$file` (\n$r.output\n)')
|
||||||
exit(1)
|
exit(1)
|
||||||
} else {
|
} else {
|
||||||
println('OK')
|
println('OK')
|
||||||
|
@ -345,6 +345,8 @@ pub fn (v mut V) cc_msvc() {
|
|||||||
|
|
||||||
if !v.pref.is_prod {
|
if !v.pref.is_prod {
|
||||||
a << '/DEBUG:FULL'
|
a << '/DEBUG:FULL'
|
||||||
|
} else {
|
||||||
|
a << '/DEBUG:NONE'
|
||||||
}
|
}
|
||||||
|
|
||||||
args := a.join(' ')
|
args := a.join(' ')
|
||||||
|
@ -20,19 +20,25 @@ echo fetch v_win.c
|
|||||||
curl -O https://raw.githubusercontent.com/vlang/vc/master/v_win.c
|
curl -O https://raw.githubusercontent.com/vlang/vc/master/v_win.c
|
||||||
|
|
||||||
echo build v_win.c with msvc
|
echo build v_win.c with msvc
|
||||||
cl.exe /w /volatile:ms /D_UNICODE /DUNICODE /Fo.v_win.c.obj /O2 /MD v_win.c user32.lib kernel32.lib advapi32.lib shell32.lib /link /NOLOGO /OUT:v2.exe /INCREMENTAL:NO
|
cl.exe /w /volatile:ms /D_UNICODE /DUNICODE /D_BOOTSTRAP_NO_UNICODE_STREAM /Fo.v_win.c.obj /O2 /MD v_win.c user32.lib kernel32.lib advapi32.lib shell32.lib /link /DEBUG:NONE /NOLOGO /OUT:v2.exe /INCREMENTAL:NO
|
||||||
|
|
||||||
if %ERRORLEVEL% GEQ 1 (
|
if %ERRORLEVEL% GEQ 1 (
|
||||||
goto :compileerror
|
goto :compileerror
|
||||||
)
|
)
|
||||||
|
|
||||||
echo rebuild from source
|
echo rebuild from source
|
||||||
v2.exe -o v.exe compiler
|
v2.exe -os msvc -o v.exe compiler
|
||||||
|
|
||||||
|
if %ERRORLEVEL% GEQ 1 (
|
||||||
|
goto :compileerror
|
||||||
|
)
|
||||||
|
|
||||||
del .v_win.c.obj
|
del .v_win.c.obj
|
||||||
del v_win.c
|
del v_win.c
|
||||||
del v2.exe
|
del v2.exe
|
||||||
|
|
||||||
|
echo Success
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
:nomsvc
|
:nomsvc
|
||||||
|
@ -36,27 +36,20 @@ if %ERRORLEVEL% NEQ 0 goto :fail
|
|||||||
|
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
echo testing v
|
echo testing v
|
||||||
for /r . %%x in (*_test.v) do (
|
v test v
|
||||||
v -o test.exe -debug %%x
|
if %ERRORLEVEL% NEQ 0 goto :fail
|
||||||
if !ERRORLEVEL! NEQ 0 goto :fail
|
|
||||||
)
|
|
||||||
echo testing v.msvc
|
echo testing v.msvc
|
||||||
for /r . %%x in (*_test.v) do (
|
v.msvc.exe test v
|
||||||
v.msvc.exe -o test.exe -debug %%x
|
if %ERRORLEVEL% NEQ 0 goto :fail
|
||||||
if !ERRORLEVEL! NEQ 0 goto :fail
|
|
||||||
)
|
|
||||||
|
|
||||||
echo testing v -os msvc
|
echo testing v -os msvc
|
||||||
for /r . %%x in (*_test.v) do (
|
v -os msvc test v
|
||||||
v -os msvc -o test.exe -debug %%x
|
if %ERRORLEVEL% NEQ 0 goto :fail
|
||||||
if !ERRORLEVEL! NEQ 0 goto :fail
|
|
||||||
)
|
|
||||||
|
|
||||||
echo testing v.msvc -os msvc
|
echo testing v.msvc -os msvc
|
||||||
for /r . %%x in (*_test.v) do (
|
v.msvc.exe -os msvc test v
|
||||||
v.msvc.exe -os msvc -o test.exe -debug %%x
|
if %ERRORLEVEL% NEQ 0 goto :fail
|
||||||
if !ERRORLEVEL! NEQ 0 goto :fail
|
|
||||||
)
|
|
||||||
|
|
||||||
goto :done
|
goto :done
|
||||||
|
|
||||||
|
BIN
vlib/json/json_test.exp
Normal file
BIN
vlib/json/json_test.exp
Normal file
Binary file not shown.
BIN
vlib/json/json_test.lib
Normal file
BIN
vlib/json/json_test.lib
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user