Skip to content

Commit

Permalink
Rakefile: Add test_fips task for convenience.
Browse files Browse the repository at this point in the history
  • Loading branch information
junaruga committed Sep 19, 2023
1 parent bdf060f commit 0b83eed
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ jobs:
run: echo "OPENSSL_CONF=$(pwd)/test/openssl/fixtures/ssl/openssl_fips.cnf" >> $GITHUB_ENV
if: matrix.fips-enabled

- name: set fips environment variable for testing.
run: echo "TEST_RUBY_OPENSSL_FIPS_ENABLED=true" >> $GITHUB_ENV
if: matrix.fips-enabled

- name: load ruby
uses: ruby/setup-ruby@v1
with:
Expand Down Expand Up @@ -180,7 +176,5 @@ jobs:
# TODO Fix other tests, and run all the tests on FIPS module.
- name: test on fips module
run: |
bundle exec rake debug &&
ruby -I./lib -ropenssl \
-e 'Dir.glob "./test/openssl/{test_fips.rb,test_pkey.rb}", &method(:require)'
rake test_fips TESTOPTS="-v --no-show-detail-immediately"
if: matrix.fips-enabled
16 changes: 16 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,28 @@ Rake::TestTask.new do |t|
t.warning = true
end

desc 'Run tests for fips'
task :test_fips do
ENV['TEST_RUBY_OPENSSL_FIPS_ENABLED'] = 'true'
Rake::Task['test_fips_internal'].invoke
end

Rake::TestTask.new(:test_fips_internal) do |t|
t.libs << 'test/openssl'
t.test_files = FileList[
'test/openssl/test_fips.rb',
'test/openssl/test_pkey.rb',
]
t.warning = true
end

RDoc::Task.new do |rdoc|
rdoc.main = "README.md"
rdoc.rdoc_files.include("*.md", "lib/**/*.rb", "ext/**/*.c")
end

task :test => [:compile, :debug]
task :test_fips => [:compile, :debug]

# Print Ruby and compiler info for debugging purpose.
task :debug_compiler do
Expand Down

0 comments on commit 0b83eed

Please sign in to comment.