The ruby shared tests
  • Shell 94.2%
  • Ruby 5.8%
Find a file
Vít Ondruch f6f6efdfe9 Install Psych devel dependencies
This prevents `bundle install` failures like:

~~~
:: [ 00:30:49 ] :: [  BEGIN   ] :: Creating new rails application :: actually running 'rails new app | tee bundle.log'
      create
      create  README.md

... snip ...

Fetching rails 7.0.8.6
Installing rails 7.0.8.6
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/share/gems/gems/psych-5.2.0/ext/psych
/usr/bin/ruby -I/usr/share/rubygems extconf.rb
checking for pkg-config for yaml-0.1... not found
checking for yaml.h... no
yaml.h not found
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include=${opt-dir}/include
	--without-opt-include
	--with-opt-lib=${opt-dir}/lib64
	--without-opt-lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/$(RUBY_BASE_NAME)
	--with-libyaml-source-dir
	--without-libyaml-source-dir
	--with-yaml-0.1-dir
	--without-yaml-0.1-dir
	--with-yaml-0.1-include=${yaml-0.1-dir}/include
	--without-yaml-0.1-include
	--with-yaml-0.1-lib=${yaml-0.1-dir}/lib64
	--without-yaml-0.1-lib
	--with-yaml-0.1-config
	--without-yaml-0.1-config
	--with-pkg-config
	--without-pkg-config
	--with-libyaml-dir
	--without-libyaml-dir
	--with-libyaml-include=${libyaml-dir}/include
	--without-libyaml-include
	--with-libyaml-lib=${libyaml-dir}/lib64
	--without-libyaml-lib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

  /usr/local/lib64/gems/ruby/psych-5.2.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/psych-5.2.0 for
inspection.
Results logged to /usr/local/lib64/gems/ruby/psych-5.2.0/gem_make.out

  /usr/share/rubygems/rubygems/ext/builder.rb:125:in `run'
  /usr/share/rubygems/rubygems/ext/ext_conf_builder.rb:28:in `build'
  /usr/share/rubygems/rubygems/ext/builder.rb:193:in `build_extension'
  /usr/share/rubygems/rubygems/ext/builder.rb:227:in `block in build_extensions'
  /usr/share/rubygems/rubygems/ext/builder.rb:224:in `each'
  /usr/share/rubygems/rubygems/ext/builder.rb:224:in `build_extensions'
  /usr/share/rubygems/rubygems/installer.rb:844:in `build_extensions'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/rubygems_gem_installer.rb:109:in
`build_extensions'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/source/rubygems.rb:205:in
`install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/gem_installer.rb:55:in
`install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/gem_installer.rb:17:in
`install_from_spec'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/parallel_installer.rb:133:in
`do_install'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/installer/parallel_installer.rb:124:in
`block in worker_pool'
  /usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:62:in `apply_func'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:57:in `block in
process_queue'
  <internal:kernel>:187:in `loop'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:54:in
`process_queue'
/usr/share/gems/gems/bundler-2.5.22/lib/bundler/worker.rb:90:in `block (2
levels) in create_threads'

An error occurred while installing psych (5.2.0), and Bundler cannot continue.

In Gemfile:
  debug was resolved to 1.9.2, which depends on
    irb was resolved to 1.14.1, which depends on
      rdoc was resolved to 6.7.0, which depends on
        psych
         run  bundle binstubs bundler
Resolving dependencies...
       rails  importmap:install

... snip ...
~~~

Please note that this error happens only when Fedora ships older version
of Psych then the version available on RubyGems, so the libyaml-devel
might not be always needed.

There are also other possibilities to workaround the issue, such as:

* Excluding `development` and `test` groups from installation to avoid
  the `debug` gem dependency chain.
* Using `--skip-bundle` option and modifying the Gemfile generated
  for the Ruby on Rails app.

However, I believe that this is the most probable action our users would
take.

Also note that while there are installed other binary gems, such as
Nokogiri, those ships prebuild binaries. If Psych decides to do the same
in the future, the `libyaml-devel` might become redundant.
2024-11-13 13:48:20 +01:00
.fmf Add tmt plan to run modified tests 2022-11-30 11:11:32 +01:00
run-basic-rails-application Install Psych devel dependencies 2024-11-13 13:48:20 +01:00
Sanity/native-extension-gem-is-installed-without-error Disable native.../ruby31 on rhel-10 2024-08-06 18:21:43 +02:00
systemtap-static-probes-in-ruby Improve checking for systemtap files 2024-08-05 11:50:47 +02:00
.gitignore Import 3 integration tests 2018-02-15 13:42:17 +01:00
main.fmf Remove Makefile/PURPOSE file, add summary/description 2024-07-16 18:38:49 +02:00
plans.fmf Add a plan to run all the tests. 2024-10-08 14:48:43 +02:00
README.md Add a plan to run all the tests. 2024-10-08 14:48:43 +02:00

Shared ruby tests

This repository contains shared ruby tests.

Available integration tests:

  • systemtap-static-probes-in-ruby - exercising ruby's systemtap api
  • bundler-unit-test - run bundler's unit tests
  • run-basic-rails-application - run a simple rails application

Contributing

Testing

You can run the tests in your local environment.

Install tmt.

$ sudo dnf install tmt+all

Run the following command to run the tests for Fedora rawhide:

$ tmt -c distro=fedora-rawhide run --all provision -h virtual -i fedora-rawhide
/var/tmp/tmt/run-NNN
...

The tmt's provisioning method virtual (tmt run provision -h virtual) must be used, otherwise the tests fail due to known issues with container provisioning method (tmt run provision -h container). Also note the run-NNN printed on the output of the command. This represents the run ID used with tmt run --id option in later steps.

Run the following command to see the report, setting the value of the above run ID to the --id option. As this repository doesn't have tmt's plans to run the tests, we need to set the plans --default to use the default plans. See this tmt's document about the tmt run report options.

$ tmt run --id run-NNN report -vvv

Running a specific test

You can run a specific test.

List available tests.

$ tmt test ls
/Sanity/native-extension-gem-is-installed-without-error/ruby25
/Sanity/native-extension-gem-is-installed-without-error/ruby26
/Sanity/native-extension-gem-is-installed-without-error/ruby27
/Sanity/native-extension-gem-is-installed-without-error/ruby30
/Sanity/native-extension-gem-is-installed-without-error/ruby31
/Sanity/native-extension-gem-is-installed-without-error/system
/run-basic-rails-application
/systemtap-static-probes-in-ruby

Run the following command to run a specific test with -n option to specify a regular expression to match the test name for Fedora rawhide:

$ tmt -c distro=fedora-rawhide run --all provision -h virtual -i fedora-rawhide tests -n '^/systemtap-static-probes-in-ruby$'