Skip to content

Fix marshal load error when marshal data includes "\n"#128

Merged
koic merged 1 commit intotmm1:masterfrom
arika:fix-marshal-load-error
Jun 26, 2023
Merged

Fix marshal load error when marshal data includes "\n"#128
koic merged 1 commit intotmm1:masterfrom
arika:fix-marshal-load-error

Conversation

@arika
Copy link
Contributor

@arika arika commented Jun 25, 2023

test_queue fails when bytesize of suite_name is 5.
Because marshal data includes "\n".

require 'test/unit'

class Aiueo < Test::Unit::TestCase
  def test_ok
    assert true
  end
end
$ exe/testunit-queue t.rb
Starting test-queue master (/tmp/test_queue_98954_380.sock)
<internal:marshal>:34:in `load': marshal data too short (ArgumentError)
	from /.../lib/test_queue/runner.rb:511:in `distribute_queue'
	from /.../lib/test_queue/runner.rb:228:in `execute_internal'
	from /.../lib/test_queue/runner.rb:119:in `execute'
	from exe/testunit-queue:9:in `<main>'

@koic
Copy link
Collaborator

koic commented Jun 26, 2023

Can you add the repro test below and squash the commits together afterwards?

% git diff .
diff --git a/test/examples/example_testunit.rb b/test/examples/example_testunit.rb
index bf963f7..c16fb07 100644
--- a/test/examples/example_testunit.rb
+++ b/test/examples/example_testunit.rb
@@ -8,6 +8,12 @@ class TestUnitEqual < Test::Unit::TestCase
   end
 end

+class Short < Test::Unit::TestCase
+  def test_work_with_short_class_name
+    assert true
+  end
+end
+
 30.times do |i|
   Object.const_set("TestUnitSleep#{i}", Class.new(Test::Unit::TestCase) do
     define_method(:test_sleep) do

For reference, the test below can be run:

TEST_QUEUE_WORKERS=2 TEST_QUEUE_VERBOSE=1 BUNDLE_GEMFILE=gemfiles/testunit.gemfile bundle install && vendor/bats/bin/bats test/testunit.bats

@arika
Copy link
Contributor Author

arika commented Jun 26, 2023

@koic Thank you for your review.
I added the test, squashed, and force pushed.

$ TEST_QUEUE_WORKERS=2 TEST_QUEUE_VERBOSE=1 BUNDLE_GEMFILE=gemfiles/testunit.gemfile vendor/bats/bin/bats test/testunit.bats
 ✓ testunit-queue succeeds when all tests pass
 ✓ testunit-queue fails when a test fails

2 tests, 0 failures

@koic koic merged commit 8fefaaa into tmm1:master Jun 26, 2023
@koic
Copy link
Collaborator

koic commented Jun 26, 2023

Great! Thanks!

@koic
Copy link
Collaborator

koic commented Jun 26, 2023

FYI, test-queue 0.10.0 has been released.
https://github.com/tmm1/test-queue/releases/tag/v0.10.0

@arika arika deleted the fix-marshal-load-error branch June 26, 2023 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants