Skip to content

Commit 0b83eed

Browse files
committed
Rakefile: Add test_fips task for convenience.
1 parent bdf060f commit 0b83eed

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ jobs:
148148
run: echo "OPENSSL_CONF=$(pwd)/test/openssl/fixtures/ssl/openssl_fips.cnf" >> $GITHUB_ENV
149149
if: matrix.fips-enabled
150150

151-
- name: set fips environment variable for testing.
152-
run: echo "TEST_RUBY_OPENSSL_FIPS_ENABLED=true" >> $GITHUB_ENV
153-
if: matrix.fips-enabled
154-
155151
- name: load ruby
156152
uses: ruby/setup-ruby@v1
157153
with:
@@ -180,7 +176,5 @@ jobs:
180176
# TODO Fix other tests, and run all the tests on FIPS module.
181177
- name: test on fips module
182178
run: |
183-
bundle exec rake debug &&
184-
ruby -I./lib -ropenssl \
185-
-e 'Dir.glob "./test/openssl/{test_fips.rb,test_pkey.rb}", &method(:require)'
179+
rake test_fips TESTOPTS="-v --no-show-detail-immediately"
186180
if: matrix.fips-enabled

Rakefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,28 @@ Rake::TestTask.new do |t|
1818
t.warning = true
1919
end
2020

21+
desc 'Run tests for fips'
22+
task :test_fips do
23+
ENV['TEST_RUBY_OPENSSL_FIPS_ENABLED'] = 'true'
24+
Rake::Task['test_fips_internal'].invoke
25+
end
26+
27+
Rake::TestTask.new(:test_fips_internal) do |t|
28+
t.libs << 'test/openssl'
29+
t.test_files = FileList[
30+
'test/openssl/test_fips.rb',
31+
'test/openssl/test_pkey.rb',
32+
]
33+
t.warning = true
34+
end
35+
2136
RDoc::Task.new do |rdoc|
2237
rdoc.main = "README.md"
2338
rdoc.rdoc_files.include("*.md", "lib/**/*.rb", "ext/**/*.c")
2439
end
2540

2641
task :test => [:compile, :debug]
42+
task :test_fips => [:compile, :debug]
2743

2844
# Print Ruby and compiler info for debugging purpose.
2945
task :debug_compiler do

0 commit comments

Comments
 (0)