| 1 | import os |
| 2 | import rand |
| 3 | |
| 4 | const vexe = @VEXE |
| 5 | |
| 6 | fn test_mbedtls_compiles_with_tcc_on_arm64_macos() { |
| 7 | $if !(macos && arm64) { |
| 8 | return |
| 9 | } |
| 10 | workdir := os.join_path(os.vtmp_dir(), 'v_mbedtls_tcc_arm64_${rand.ulid()}') |
| 11 | os.mkdir_all(workdir) or { panic(err) } |
| 12 | defer { |
| 13 | os.rmdir_all(workdir) or {} |
| 14 | } |
| 15 | vcache := os.join_path(workdir, 'vcache') |
| 16 | os.mkdir_all(vcache) or { panic(err) } |
| 17 | src := os.join_path(workdir, 'main.v') |
| 18 | out := os.join_path(workdir, 'main') |
| 19 | os.write_file(src, 'import net.mbedtls as _\n\nfn main() {}\n') or { panic(err) } |
| 20 | cmd := 'env VCACHE=${os.quoted_path(vcache)} ${os.quoted_path(vexe)} -nocache -cc tcc -gc none -no-retry-compilation -o ${os.quoted_path(out)} ${os.quoted_path(src)}' |
| 21 | res := os.execute(cmd) |
| 22 | if res.exit_code != 0 { |
| 23 | panic('command failed:\n${cmd}\n${res.output}') |
| 24 | } |
| 25 | } |
| 26 | |