Create a bash script that validates CWD matches the expected absolute path.
(path: &Path, expected_dir: &Path)
| 24 | |
| 25 | /// Create a bash script that validates CWD matches the expected absolute path. |
| 26 | fn write_cwd_check_script(path: &Path, expected_dir: &Path) { |
| 27 | let expected = expected_dir.to_string_lossy(); |
| 28 | let content = format!( |
| 29 | r#"#!/bin/bash |
| 30 | ACTUAL=$(pwd) |
| 31 | EXPECTED="{expected}" |
| 32 | if [ "$ACTUAL" != "$EXPECTED" ]; then |
| 33 | echo "FAIL: expected $EXPECTED, got $ACTUAL" >&2 |
| 34 | exit 1 |
| 35 | fi |
| 36 | "# |
| 37 | ); |
| 38 | fs::write(path, content).unwrap(); |
| 39 | fs::set_permissions(path, fs::Permissions::from_mode(0o755)).unwrap(); |
| 40 | } |
| 41 | |
| 42 | /// Write a codspeed.yml config file. |
| 43 | fn write_config(path: &Path, content: &str) { |
no outgoing calls