Skip to content

Commit

Permalink
Fix Homebrew dirs for GitHub changing over to ARM-based OSX workers; …
Browse files Browse the repository at this point in the history
…For top-level Scarpe tests, including TestSSpecInfrastructure, use a new clean sspec.json file instead of reusing the same filename; avoid stale results (#553)
  • Loading branch information
noahgibbs authored May 6, 2024
1 parent dea674d commit 75808dc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
steps:
- name: Install dependencies
run: brew install pkg-config portaudio
- name: Configure library dirs from Homebrew for gems w/ native extensions
run: bundle config build.bloops --with-portaudio-dir=`brew --prefix portaudio`
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Ruby and install gems
Expand Down
20 changes: 11 additions & 9 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ def run_scarpe_sspec(
display_service: "wv_local",
html_renderer: "calzini"
)
test_output = File.expand_path(File.join __dir__, "sspec.json")
test_method_name = self.name
test_class_name = self.class.name

with_tempfile("scarpe_log_config.json", JSON.dump(log_config_for_test)) do |scarpe_log_config|
with_tempfiles([
[["scarpe_log_config", "json"], JSON.dump(log_config_for_test)],
[["sspec_test_output", "json"], ""]
]) do |scarpe_log_config, test_output|
# Start the application using the exe/scarpe utility
# For unit testing always supply --debug so we get the most logging
cmd = \
Expand All @@ -79,15 +81,15 @@ def run_scarpe_sspec(
assert false, "Expected sspec test process to return failure and it succeeded! Exit code: #{$?.exitstatus}"
end
end
end

result = Scarpe::Components::MinitestResult.new(test_output)
correct, msg = result.check(expect_result:, min_asserts: expect_assertions_min, max_asserts: expect_assertions_max)
result = Scarpe::Components::MinitestResult.new(test_output)
correct, msg = result.check(expect_result:, min_asserts: expect_assertions_min, max_asserts: expect_assertions_max)

if correct
assert_equal true, true # Yup, worked fine
else
assert false, "Minitest result: #{msg}"
if correct
assert_equal true, true # Yup, worked fine
else
assert false, "Minitest result: #{msg}"
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/test_sspec_infrastructure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_empty_assertions
# can't usefully tell the timeout to cause the *process* to fail just from the timeout.
# We'll still notice test failures or not hitting enough assertions.
def test_timeout_no_fail
run_scarpe_sspec_code(<<~'SSPEC', timeout: 1.0, wait_after_test: true, expect_assertions_min: 1)
run_scarpe_sspec_code(<<~'SSPEC', timeout: 2.0, wait_after_test: true, expect_assertions_min: 1)
---
----------- app code
Shoes.app do
Expand All @@ -44,7 +44,7 @@ def test_timeout_no_fail
end

def test_timeout_test_fail
run_scarpe_sspec_code(<<~'SSPEC', timeout: 1.0, wait_after_test: true, expect_result: :fail)
run_scarpe_sspec_code(<<~'SSPEC', timeout: 2.0, wait_after_test: true, expect_result: :fail)
---
----------- app code
Shoes.app do
Expand Down

0 comments on commit 75808dc

Please sign in to comment.