Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test --use-system-libraries option in Travis CI #128

Closed
wants to merge 1 commit into from

Conversation

skalee
Copy link
Contributor

@skalee skalee commented Mar 21, 2019

This gem can be installed with a --use-system-libraries option, but till now it wasn't tested. This pull request fixes that.

Actually, $RUBY_GPGME_USE_SYSTEM_LIBRARIES environment variable is used instead of --use-system-libraries, but they are equivalent.

@skalee
Copy link
Contributor Author

skalee commented Mar 21, 2019

Oh, I have doubled the number of build jobs so that this option is tested against every Ruby. However, if it's a problem, I can reduce it to a single additional job, e.g:

matrix:
  include:
    - env: RUBY_GPGME_USE_SYSTEM_LIBRARIES=1

@coveralls
Copy link

coveralls commented Mar 21, 2019

Coverage Status

Coverage increased (+0.1%) to 88.965% when pulling aa7722d on skalee:test-with-system-libs into c9e924f on ueno:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 88.798% when pulling 16a6e5a on skalee:test-with-system-libs into c9e924f on ueno:master.

Actually, $RUBY_GPGME_USE_SYSTEM_LIBRARIES environment variable is
tested, but it is equivalent.
@skalee skalee force-pushed the test-with-system-libs branch from 16a6e5a to aa7722d Compare March 21, 2019 22:56
@skalee
Copy link
Contributor Author

skalee commented Mar 22, 2019

Tests have failed for all Travis jobs which are testing --use-system-libraries option. For Ruby 2.5 build, the test summary says "111 tests, 194 assertions, 5 failures, 1 errors, 7 skips" when this option is on, and "111 tests, 205 assertions, 0 failures, 0 errors, 7 skips" when it's off.

Possibly all these errors/failures have single reason. I have investigated one of them:

  9) Error:
test_0002_selects_who_to_sign_for(GPGME::Crypto::sign):
EOFError: EOFError
    /home/travis/build/ueno/ruby-gpgme/lib/gpgme/ctx.rb:333:in `get_key'
    /home/travis/build/ueno/ruby-gpgme/lib/gpgme/key.rb:68:in `block in get'
    /home/travis/build/ueno/ruby-gpgme/lib/gpgme/ctx.rb:79:in `new'
    /home/travis/build/ueno/ruby-gpgme/lib/gpgme/key.rb:67:in `get'
    /home/travis/build/ueno/ruby-gpgme/test/crypto_test.rb:237:in `block (3 levels) in <top (required)>'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/mocha-0.9.12/lib/mocha/integration/mini_test/version_201_to_202.rb:27:in `run'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:683:in `block in _run_suite'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in `map'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:676:in `_run_suite'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in `block in _run_suites'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in `map'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:666:in `_run_suites'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:642:in `_run_anything'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:804:in `run_tests'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:791:in `block in _run'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:790:in `each'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:790:in `_run'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:779:in `run'
    /home/travis/.rvm/gems/ruby-2.5.0/gems/minitest-2.1.0/lib/minitest/unit.rb:560:in `block in autorun'

A failing test looks as follows:

    it "selects who to sign for" do
      crypto  = GPGME::Crypto.new
      sign    = crypto.sign "Hi there", :signer => KEYS.last[:sha]
      key     = GPGME::Key.get(KEYS.last[:sha]) # <= FAILS HERE
      # ...
    end

The KEYS Array contains four items as defined in test/support/resources.rb:

However, the last key is unavailable in GPGME for some reason:

GPGME::Key.find(:public).flat_map(&:uids)
# => [#<GPGME::UserID Test number 1 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 2 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 3 <[email protected]> validity=unknown, signatures=[]>]
GPGME::Key.find(:secret).flat_map(&:uids)
# => [#<GPGME::UserID Test number 1 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 2 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 3 <[email protected]> validity=unknown, signatures=[]>]

Interestingly, when I tried to import that missing key by hand, it has been added:

GPGME::Key.import(KEYS.last[:public])
GPGME::Key.find(:public).flat_map(&:uids)
# => [#<GPGME::UserID Test number 1 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 2 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 3 <[email protected]> validity=unknown, signatures=[]>, #<GPGME::UserID Test number 4 <[email protected]> validity=unknown, signatures=[]>]
GPGME::Key.get(KEYS.last[:sha]) # <= NO ERROR!

Some race condition, perhaps? (EDIT: Adding sleep 1 at the end of #import_keys in test_helper.rb didn't help).

stanhu added a commit to stanhu/ruby-gpgme that referenced this pull request Aug 28, 2024
stanhu added a commit to stanhu/ruby-gpgme that referenced this pull request Aug 28, 2024
stanhu added a commit to stanhu/ruby-gpgme that referenced this pull request Aug 28, 2024
@stanhu
Copy link
Collaborator

stanhu commented Aug 28, 2024

Closing in favor of #191.

@stanhu stanhu closed this Aug 28, 2024
stanhu added a commit that referenced this pull request Aug 28, 2024
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.

3 participants