Skip to content

Commit

Permalink
test: bring up macos testing (#172)
Browse files Browse the repository at this point in the history
* Fixes SIGSTOP issue on macOS
* Enables macOS testing in PR/CI workflows
* Adjusts tests to get passing baseline
  • Loading branch information
reubeno authored Sep 26, 2024
1 parent 1ea458c commit d6f817e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 24 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,10 @@ jobs:
artifact_suffix: ""
name_suffix: "(linux)"

#
# TODO: Re-enable once tests are passing.
#
# - host: "macos-latest"
# variant: "macos"
# artifact_suffix: "-macos"
# name_suffix: "(macOS) -- ** not yet expected to pass **"
- host: "macos-latest"
variant: "macos"
artifact_suffix: "-macos"
name_suffix: "(macOS)"

name: "Test ${{ matrix.name_suffix }}"
runs-on: ${{ matrix.host }}
Expand Down
6 changes: 3 additions & 3 deletions brush-core/src/sys/unix/signal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ pub(crate) fn kill_process(pid: u32) -> Result<(), error::Error> {
Ok(())
}

const SIGTSTP: std::os::raw::c_int = 20;

pub(crate) fn tstp_signal_listener() -> Result<tokio::signal::unix::Signal, error::Error> {
let signal = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::from_raw(SIGTSTP))?;
let signal = tokio::signal::unix::signal(tokio::signal::unix::SignalKind::from_raw(
nix::libc::SIGTSTP,
))?;
Ok(signal)
}

Expand Down
4 changes: 2 additions & 2 deletions brush-shell/tests/cases/builtins/cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ cases:
echo $?
echo "pwd: $PWD"
echo "cd tmp"
cd tmp
echo "cd usr"
cd usr
echo $?
echo "pwd: $PWD"
Expand Down
4 changes: 2 additions & 2 deletions brush-shell/tests/cases/builtins/command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ cases:
- name: "command -v"
stdin: |
command -v echo
command -v ls
command -v $(which ls)
command -v cat
command -v $(command -v cat)
command -v non-existent || echo "1. Not found"
command -v /usr/bin/non-existent || echo "2. Not found"
Expand Down
2 changes: 1 addition & 1 deletion brush-shell/tests/cases/builtins/dot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cases:
}
stdin: |
var="orig"
source script.sh
source ./script.sh
echo "var: ${var}"
script_func
Expand Down
6 changes: 3 additions & 3 deletions brush-shell/tests/cases/builtins/pushd_popd_dirs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ cases:
- name: "dirs with tilde replacement"
stdin: |
HOME=/tmp
HOME=/usr
cd ~
echo "PWD: $PWD"
dirs
dirs -l
- name: "dirs to clear"
stdin: |
cd /tmp
pushd /tmp
cd /usr
pushd /usr
pushd /
dirs -c
dirs
2 changes: 1 addition & 1 deletion brush-shell/tests/cases/builtins/pwd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ cases:
pwd
echo "Result: $?"
#
cd tmp
cd usr
pwd
echo "Result: $?"
5 changes: 3 additions & 2 deletions brush-shell/tests/cases/extended_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ cases:
stdin: |
regex="^$"
[[ "" =~ '' ]] && echo "1. Matched"
# TODO: The commented out lines appear differ in behavior between versions of bash.
# [[ "" =~ '' ]] && echo "1. Matched"
[[ "" =~ '^$' ]] && echo "2. Matched"
[[ "" =~ "" ]] && echo "3. Matched"
# [[ "" =~ "" ]] && echo "3. Matched"
[[ "" =~ "^$" ]] && echo "4. Matched"
[[ "" =~ ^$ ]] && echo "5. Matched"
[[ "" =~ ${regex} ]] && echo "6. Matched"
Expand Down
2 changes: 1 addition & 1 deletion brush-shell/tests/cases/prompt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cases:
- name: "Working dir based prompts"
stdin: |
cd /tmp
cd /usr
prompt='\w '
echo "Prompt: '${prompt@P}'"
Expand Down
4 changes: 2 additions & 2 deletions brush-shell/tests/cases/word_expansion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ cases:
echo "\${arr2@Q}: ${arr2@Q}"
- name: "Parameter quote transformations - K"
known_failure: true
skip: true # TODO: Figure out why this succeeds on macOS but fails on Linux
stdin: |
var='""'
echo "\${var@K}: ${var@K}"
Expand All @@ -720,7 +720,7 @@ cases:
echo "\${arr2[*]@K}: ${arr2[*]@K}"
- name: "Parameter quote transformations - k"
known_failure: true
skip: true # TODO: Figure out why this succeeds on macOS but fails on Linux
stdin: |
var='""'
echo "\${var@k}: ${var@k}"
Expand Down

0 comments on commit d6f817e

Please sign in to comment.