fortrangoingonforty/armfortas / 1f4cb87

Browse files

Sandbox fortsh graph outputs

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
1f4cb8787aef7fdf4d7d65465ad7f65495fc52bc
Parents
bb95ce8
Tree
37bada4

2 changed files

StatusFile+-
M .gitignore 1 0
M tests/fortsh_module_graph.rs 6 1
.gitignoremodified
@@ -23,4 +23,5 @@ AGENTS.md
2323
 /*.ir
2424
 /*.o
2525
 /*.mod
26
+/*.amod
2627
 /scratch/
tests/fortsh_module_graph.rsmodified
@@ -20,6 +20,9 @@ use std::process::Command;
2020
 const FORTSH_COMPILED_FLOOR: usize = 14;
2121
 
2222
 fn find_compiler() -> PathBuf {
23
+    if let Some(path) = std::env::var_os("CARGO_BIN_EXE_armfortas") {
24
+        return PathBuf::from(path);
25
+    }
2326
     for c in &["target/debug/armfortas", "target/release/armfortas"] {
2427
         let p = PathBuf::from(c);
2528
         if p.exists() {
@@ -37,7 +40,7 @@ fn find_fortsh() -> Option<PathBuf> {
3740
     ];
3841
     for c in &candidates {
3942
         if c.is_dir() {
40
-            return Some(c.clone());
43
+            return fs::canonicalize(c).ok();
4144
         }
4245
     }
4346
     None
@@ -224,6 +227,7 @@ fn fortsh_module_graph_resolves() {
224227
         let obj = build_dir.join(format!("{}.o", stem));
225228
 
226229
         let result = Command::new(&compiler)
230
+            .current_dir(&build_dir)
227231
             .args([
228232
                 src.to_str().unwrap(),
229233
                 "-c",
@@ -231,6 +235,7 @@ fn fortsh_module_graph_resolves() {
231235
                 "-DUSE_C_STRINGS",
232236
                 "-o",
233237
                 obj.to_str().unwrap(),
238
+                &format!("-J{}", build_dir.display()),
234239
                 &format!("-I{}", build_dir.display()),
235240
             ])
236241
             .output()