tools: add a test for crosscompiling hw, on linux and macos, to FreeBSD (#21553)

This commit is contained in:
Delyan Angelov 2024-05-23 13:45:57 +03:00 committed by GitHub
parent 98ea85170b
commit 463125e20a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,6 +20,8 @@ const hw_native_no_builtin_size_limit = 300
const l2w_crosscc = os.find_abs_path_of_executable('x86_64-w64-mingw32-gcc-win32') or { '' } const l2w_crosscc = os.find_abs_path_of_executable('x86_64-w64-mingw32-gcc-win32') or { '' }
const clang_path = os.find_abs_path_of_executable('clang') or { '' }
fn main() { fn main() {
mut commands := get_all_commands() mut commands := get_all_commands()
// summary // summary
@ -139,6 +141,23 @@ fn get_all_commands() []Command {
runcmd: .execute runcmd: .execute
expect: 'Hello, World!\n' expect: 'Hello, World!\n'
} }
if clang_path != '' {
res << Command{
line: '${vexe} -os freebsd -gc none examples/hello_world.v'
okmsg: 'V cross compiles hello_world.v, to a FreeBSD executable'
rmfile: 'examples/hello_world'
after_cb: fn () ! {
for file in ['examples/hello_world',
os.join_path(os.vmodules_dir(), 'freebsdroot/usr/include/stdio.h')] {
if !os.exists(file) {
return error('>> file ${file} does not exist')
}
}
}
}
} else {
eprintln('Testing cross compilation to FreeBSD, needs clang.')
}
if os.getenv('V_CI_MUSL').len == 0 { if os.getenv('V_CI_MUSL').len == 0 {
for compiler_name in ['clang', 'gcc'] { for compiler_name in ['clang', 'gcc'] {
if _ := os.find_abs_path_of_executable(compiler_name) { if _ := os.find_abs_path_of_executable(compiler_name) {