aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Čertík <ondrej@certik.us>2020-01-14 13:40:08 -0700
committerGitHub <noreply@github.com>2020-01-14 13:40:08 -0700
commit772d16a78abda39f2b3d6d3bb91253835bf0ff99 (patch)
tree34fcfe2eb5021e489f74279b6eebbb6e1fea1252
parentbf8ee015890da9528572b9dbc8eeaa4dd57e132c (diff)
parent3d95847e2871f77967c3664372266087c31019cb (diff)
downloadfpm-772d16a78abda39f2b3d6d3bb91253835bf0ff99.tar.gz
fpm-772d16a78abda39f2b3d6d3bb91253835bf0ff99.zip
Merge pull request #10 from certik/tests2
Prepare fpm to run on Windows using Rust tests
-rw-r--r--.github/workflows/CI.yml1
-rw-r--r--Cargo.toml4
-rw-r--r--src/main.rs18
-rw-r--r--tests/1/main.f902
-rw-r--r--tests/2/main.f902
5 files changed, 22 insertions, 5 deletions
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:
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"
diff --git a/src/main.rs b/src/main.rs
index 8fb71c2..35dde13 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);
@@ -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));
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