specs: run each build test from separate directory; keep directory if test fails
This commit is contained in:
parent
cd9fffd828
commit
95d5ada865
@ -25,16 +25,34 @@ describe Rscons do
|
|||||||
|
|
||||||
before(:all) do
|
before(:all) do
|
||||||
@statics = {}
|
@statics = {}
|
||||||
@build_test_run_dir = File.expand_path("build_test_run")
|
@build_test_run_base_dir = File.expand_path("build_test_run")
|
||||||
@run_results = Struct.new(:stdout, :stderr, :status)
|
@run_results = Struct.new(:stdout, :stderr, :status)
|
||||||
@owd = Dir.pwd
|
@owd = Dir.pwd
|
||||||
rm_rf(@build_test_run_dir)
|
rm_rf(@build_test_run_base_dir)
|
||||||
|
FileUtils.mkdir_p(@build_test_run_base_dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:each) do
|
before(:each) do
|
||||||
|
@statics[:example_id] ||= 0
|
||||||
|
@statics[:example_id] += 1
|
||||||
|
@build_test_run_dir = "#{@build_test_run_base_dir}/test#{@statics[:example_id]}"
|
||||||
|
end
|
||||||
|
|
||||||
|
after(:each) do |example|
|
||||||
Dir.chdir(@owd)
|
Dir.chdir(@owd)
|
||||||
|
if example.exception
|
||||||
|
@statics[:keep_test_run_dir] = true
|
||||||
|
puts "Leaving #{@build_test_run_dir} for inspection due to test failure"
|
||||||
|
else
|
||||||
rm_rf(@build_test_run_dir)
|
rm_rf(@build_test_run_dir)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
after(:all) do
|
||||||
|
unless @statics[:keep_test_run_dir]
|
||||||
|
rm_rf(@build_test_run_base_dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_dir(build_test_directory)
|
def test_dir(build_test_directory)
|
||||||
Dir.chdir(@owd)
|
Dir.chdir(@owd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user