From e083ce55d0edcddb9df753586fab6540b4f1e727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 14 Jan 2020 13:33:11 -0700 Subject: Print Rust stacktrace when error happens --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a3678a1..3fc511f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,6 +12,7 @@ env: HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" HOMEBREW_NO_GITHUB_API: "ON" HOMEBREW_NO_INSTALL_CLEANUP: "ON" + RUST_BACKTRACE: "1" # Make Rust print full backtrace on error jobs: Build: -- cgit v1.2.3 From 0575acc7cea7444c11cbe0da673211bc99cec68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 14 Jan 2020 13:33:40 -0700 Subject: Add test Rust dependencies --- Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 868f563..094a80f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,7 @@ edition = "2018" [dependencies] structopt = "0.3.7" + +[dev-dependencies] +assert_cmd = "0.10" +predicates = "1" -- cgit v1.2.3 From c5c515d2ba1ea9430cb2581eb98899a7d19b5a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 14 Jan 2020 13:33:55 -0700 Subject: Replace \ to / (needed for Windows) --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 8fb71c2..59e4c81 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,7 +30,7 @@ fn build() { for file in &files { println!("File: {}", file); if !file.ends_with("main.f90") { - files2 = files2 + " " + file; + files2 = files2 + " " + &file.replace("\\", "/"); } } println!("Files: {:?}", files); -- cgit v1.2.3 From 8215872be25a06640b2a126fdc9f66e11f9b518a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 14 Jan 2020 13:34:41 -0700 Subject: Construct the correct cmake call on Windows --- src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 59e4c81..35dde13 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,8 +44,17 @@ project(p1) add_executable(p1 main.f90 {}) ", files2); std::fs::write("CMakeLists.txt", s).unwrap(); + + let mut args: Vec<&str> = vec![]; + if cfg!(windows) { + args.extend(vec!["-G", "MinGW Makefiles", + "-DCMAKE_SH=CMAKE_SH-NOTFOUND"]) + }; + args.extend(vec!["-B", "build", "."]); + println!("[+] cmake {:?}", args); let output = std::process::Command::new("cmake") - .args(&["-B", "build", "."]) + .args(&args) + .env("FC", "gfortran") .output().unwrap(); println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); @@ -54,8 +63,11 @@ add_executable(p1 main.f90 {}) panic!("Command failed.") } + println!(""); + let args = vec!["--build", "build"]; + println!("[+] cmake {:?}", args); let output = std::process::Command::new("cmake") - .args(&["--build", "build"]) + .args(&args) .output().unwrap(); println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); -- cgit v1.2.3 From 3d95847e2871f77967c3664372266087c31019cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 14 Jan 2020 13:34:58 -0700 Subject: Print better output from tests --- tests/1/main.f90 | 2 +- tests/2/main.f90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/1/main.f90 b/tests/1/main.f90 index 75914de..d886be3 100644 --- a/tests/1/main.f90 +++ b/tests/1/main.f90 @@ -4,5 +4,5 @@ implicit none call f() -print *, "OK" +print *, "TEST1 OK" end diff --git a/tests/2/main.f90 b/tests/2/main.f90 index 580da98..bd820eb 100644 --- a/tests/2/main.f90 +++ b/tests/2/main.f90 @@ -1,5 +1,5 @@ program test2 implicit none -print *, "OK" +print *, "TEST2 OK" end -- cgit v1.2.3