mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-03 14:12:53 +00:00
use initialize_zig_test_platforms in all cli_tests
This commit is contained in:
parent
f4451722e8
commit
f8304477f6
2 changed files with 14 additions and 6 deletions
|
|
@ -76,6 +76,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn platform_switching_zig() {
|
||||
copy_zig_glue::initialize_zig_test_platforms();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("examples/platform-switching", "rocLovesZig.roc"),
|
||||
|
|
@ -96,6 +98,8 @@ mod cli_tests {
|
|||
|
||||
#[test]
|
||||
fn platform_switching_wasm() {
|
||||
copy_zig_glue::initialize_zig_test_platforms();
|
||||
|
||||
// this is a web assembly example, but we don't test with JS at the moment
|
||||
// so let's just check it for now
|
||||
let cli_check = ExecCli::new(
|
||||
|
|
@ -113,6 +117,8 @@ mod cli_tests {
|
|||
ignore = "Flaky failure: Roc command failed with status ExitStatus(ExitStatus(3221225477))"
|
||||
)]
|
||||
fn fibonacci() {
|
||||
copy_zig_glue::initialize_zig_test_platforms();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("crates/cli/tests/test-projects/algorithms", "fibonacci.roc"),
|
||||
|
|
@ -134,6 +140,8 @@ mod cli_tests {
|
|||
#[test]
|
||||
#[cfg_attr(windows, ignore)]
|
||||
fn quicksort() {
|
||||
copy_zig_glue::initialize_zig_test_platforms();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("crates/cli/tests/test-projects/algorithms", "quicksort.roc"),
|
||||
|
|
@ -983,6 +991,8 @@ mod cli_tests {
|
|||
/// Build the platform host once for all tests in this module
|
||||
fn build_platform_host() {
|
||||
BUILD_PLATFORM_HOST.call_once(|| {
|
||||
copy_zig_glue::initialize_zig_test_platforms();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root("crates/cli/tests/benchmarks/platform", "app.roc"),
|
||||
|
|
@ -1270,6 +1280,8 @@ mod cli_tests {
|
|||
#[cfg_attr(windows, ignore)]
|
||||
/// this tests that a platform can correctly import a package
|
||||
fn platform_requires_pkg() {
|
||||
copy_zig_glue::initialize_zig_test_platforms();
|
||||
|
||||
let cli_build = ExecCli::new(
|
||||
CMD_BUILD,
|
||||
file_from_root(
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ use std::{fs, io};
|
|||
static ZIG_PLATFORM_COPY_GLUE_ONCE: Once = Once::new();
|
||||
|
||||
/// Copies the glue source files for zig platforms from the roc builtins
|
||||
/// this is only temporary, see comments in crates/copy_zig_glue/src/main.rs
|
||||
/// this is only temporary, we should create a zig package for the test platforms
|
||||
pub fn initialize_zig_test_platforms() {
|
||||
ZIG_PLATFORM_COPY_GLUE_ONCE.call_once(|| {
|
||||
dbg!("ZIG_PLATFORM_COPY_GLUE_ONCE");
|
||||
// initialization code here
|
||||
copy_zig_glue();
|
||||
});
|
||||
}
|
||||
|
|
@ -20,9 +18,7 @@ pub fn initialize_zig_test_platforms() {
|
|||
/// This is a simple way to use these files without creating a zig package,
|
||||
/// to support the upgrade from zig 0.11.0 to 0.13.0, and keep the scope of the change smaller.
|
||||
///
|
||||
/// Once we have zig 0.13.0, and also removed platform/host rebuilding, we will need to upgrade the
|
||||
/// test platforms so they produce their own host binaries, and this will be the best time to
|
||||
/// upgrade to a zig package and can also be done incrementally withouth changing all the platforms in one go.
|
||||
/// Once we have zig 0.13.0, we should add a zig package for the test platforms.
|
||||
pub fn copy_zig_glue() {
|
||||
let workspace_dir = roc_test_utils_dir::workspace_root();
|
||||
let zig_builtins_source_dir = workspace_dir.join("crates/compiler/builtins/bitcode/src");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue