albacore 2.6.4 → 2.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/albacore/dsl.rb +0 -11
- data/lib/albacore/nuget_model.rb +9 -6
- data/lib/albacore/task_types/find_msbuild_versions.rb +5 -0
- data/lib/albacore/task_types/nugets_restore.rb +1 -0
- data/lib/albacore/version.rb +1 -1
- data/spec/dsl_spec.rb +1 -1
- data/spec/nuget_model_spec.rb +3 -1
- metadata +2 -5
- data/lib/albacore/task_types/test_runner.rb +0 -200
- data/spec/test_runner_spec.rb +0 -340
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fed563fd034b47695f62584a8742278ef369007
|
4
|
+
data.tar.gz: e4421db741ff0bde734b0a73f5c3b74b0863bbfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c592bb8fdde41fc4e0f2e2a8ee4a710f81e8b56a9129fd70ccaeb0b63912d0b9e91680334c340960405bd62ee34d00f0d606184e995a650934b82922500cc30
|
7
|
+
data.tar.gz: f1e6d65a43954c054c29c55de33597d4e95fddc0a29a20cc9924f3defd15436bd6fa9904db166e1bad1fa45265430dc786d93b4c5185250f8c015493740eecb0
|
data/lib/albacore/dsl.rb
CHANGED
@@ -75,17 +75,6 @@ module Albacore
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
# basically a command with some parameters; allows you to execute your
|
79
|
-
# tests with albacore
|
80
|
-
def test_runner *args, &block
|
81
|
-
require 'albacore/task_types/test_runner'
|
82
|
-
Albacore.define_task *args do |task_name, own_args|
|
83
|
-
c = Albacore::TestRunner::Config.new
|
84
|
-
yield c, own_args
|
85
|
-
Albacore::TestRunner::Task.new(c.opts).execute
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
78
|
# Restore hint paths to registered nugets
|
90
79
|
def restore_hint_paths *args, &block
|
91
80
|
require 'albacore/tools/restore_hint_paths'
|
data/lib/albacore/nuget_model.rb
CHANGED
@@ -144,11 +144,13 @@ end})
|
|
144
144
|
x.dependency id: d.id, version: d.version
|
145
145
|
}
|
146
146
|
}
|
147
|
-
|
148
|
-
|
149
|
-
|
147
|
+
if @frameworkAssemblies.respond_to? :each
|
148
|
+
x.frameworkAssemblies {
|
149
|
+
@framework_assemblies.each { |k, d|
|
150
|
+
x.frameworkAssembly assemblyName: d.id, targetFramework: d.version
|
151
|
+
}
|
150
152
|
}
|
151
|
-
|
153
|
+
end
|
152
154
|
}
|
153
155
|
end
|
154
156
|
end
|
@@ -386,8 +388,9 @@ end})
|
|
386
388
|
end
|
387
389
|
end
|
388
390
|
|
389
|
-
|
390
|
-
|
391
|
+
|
392
|
+
fd = opts.get :framework_dependencies
|
393
|
+
if fd && fd.respond_to?(:each)
|
391
394
|
fd.each { |n, p|
|
392
395
|
package.metadata.add_framework_dependency p.id, p.version
|
393
396
|
}
|
@@ -20,6 +20,11 @@ module Albacore
|
|
20
20
|
rescue
|
21
21
|
error "failed to open HKLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions"
|
22
22
|
end
|
23
|
+
|
24
|
+
# MSBuild 15, assume default installation path
|
25
|
+
vs2017_dir = Dir[File.join(ENV['ProgramFiles(x86)'].gsub('\\', '/'), 'Microsoft Visual Studio', '2017', '*')].first
|
26
|
+
retval[15] = File.join(vs2017_dir, 'MSBuild', '15.0', 'Bin') unless vs2017_dir.nil?
|
27
|
+
|
23
28
|
return retval
|
24
29
|
end
|
25
30
|
end
|
@@ -55,6 +55,7 @@ module Albacore
|
|
55
55
|
@parameters = [%W{install #{opts.getopt(:pkgcfg)} -OutputDirectory #{opts.getopt(:out)} -source #{@opts[:source][:uri]}}, pars.to_a].flatten
|
56
56
|
else
|
57
57
|
@parameters = [%W{install #{opts.getopt(:pkgcfg)} -OutputDirectory #{opts.getopt(:out)}}, pars.to_a].flatten
|
58
|
+
end
|
58
59
|
|
59
60
|
mono_command
|
60
61
|
end
|
data/lib/albacore/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
#puts "X has methods: #{X.new.private_methods.inspect}"
|
16
16
|
|
17
|
-
%w[nugets_restore nugets_pack asmver build
|
17
|
+
%w[nugets_restore nugets_pack asmver build restore_hint_paths appspecs].each do |sym|
|
18
18
|
method = :"#{sym}"
|
19
19
|
describe "that #{method}(*args, &block) is included when doing `require 'albacore'`" do
|
20
20
|
subject do
|
data/spec/nuget_model_spec.rb
CHANGED
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
require 'shared_contexts'
|
3
3
|
require 'albacore/paths'
|
4
4
|
require 'albacore/nuget_model'
|
5
|
+
require 'albacore/application'
|
5
6
|
|
6
7
|
describe Albacore::NugetModel::Metadata do
|
7
8
|
[ :id, :version, :authors, :title, :description, :summary, :language,
|
@@ -134,7 +135,8 @@ XML
|
|
134
135
|
# on Windows this fails due to replacement of path separators (by design)
|
135
136
|
unless ::Albacore.windows?
|
136
137
|
it 'should generate the same (semantic) XML as above' do
|
137
|
-
expect(Nokogiri::XML(subject.to_xml, &:noblanks).to_xml).to
|
138
|
+
expect(Nokogiri::XML(subject.to_xml, &:noblanks).to_xml).to \
|
139
|
+
eq(Nokogiri::XML(StringIO.new(xml), &:noblanks).to_xml)
|
138
140
|
end
|
139
141
|
end
|
140
142
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: albacore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Feldt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -170,7 +170,6 @@ files:
|
|
170
170
|
- "./lib/albacore/task_types/nugets_restore.rb"
|
171
171
|
- "./lib/albacore/task_types/sql_cmd.rb"
|
172
172
|
- "./lib/albacore/task_types/sql_package.rb"
|
173
|
-
- "./lib/albacore/task_types/test_runner.rb"
|
174
173
|
- "./lib/albacore/tasks/README.md"
|
175
174
|
- "./lib/albacore/tasks/albasemver.rb"
|
176
175
|
- "./lib/albacore/tasks/projectlint.rb"
|
@@ -347,7 +346,6 @@ files:
|
|
347
346
|
- spec/test_appspecs/corp.service/corp.service.svc/App.config
|
348
347
|
- spec/test_appspecs/corp.service/corp.service.svc/Program.fs
|
349
348
|
- spec/test_appspecs/corp.service/corp.service.svc/corp.service.svc.fsproj
|
350
|
-
- spec/test_runner_spec.rb
|
351
349
|
- spec/testdata/.gitignore
|
352
350
|
- spec/testdata/DebugProject/.gitignore
|
353
351
|
- spec/testdata/DebugProject/Degbu.fsproj
|
@@ -601,7 +599,6 @@ test_files:
|
|
601
599
|
- spec/test_appspecs/corp.service/corp.service.svc/App.config
|
602
600
|
- spec/test_appspecs/corp.service/corp.service.svc/Program.fs
|
603
601
|
- spec/test_appspecs/corp.service/corp.service.svc/corp.service.svc.fsproj
|
604
|
-
- spec/test_runner_spec.rb
|
605
602
|
- spec/testdata/.gitignore
|
606
603
|
- spec/testdata/DebugProject/.gitignore
|
607
604
|
- spec/testdata/DebugProject/Degbu.fsproj
|
@@ -1,200 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
require 'map'
|
3
|
-
require 'tmpdir'
|
4
|
-
require 'fileutils'
|
5
|
-
require 'pathname'
|
6
|
-
require 'albacore/cmd_config'
|
7
|
-
require 'albacore/cross_platform_cmd'
|
8
|
-
require 'albacore/paths'
|
9
|
-
|
10
|
-
module Albacore
|
11
|
-
module TestRunner
|
12
|
-
# the configuration object for the test runner
|
13
|
-
class Config
|
14
|
-
include CmdConfig
|
15
|
-
self.extend ConfigDSL
|
16
|
-
|
17
|
-
# give this property the list of dlls you want to test
|
18
|
-
attr_writer :files
|
19
|
-
|
20
|
-
# give this property the settings file for the dlls you want to test
|
21
|
-
attr_writer :settings
|
22
|
-
|
23
|
-
# constructor, no parameters
|
24
|
-
def initialize
|
25
|
-
@parameters = Set.new
|
26
|
-
@copy_local = false
|
27
|
-
@is_ms_test = false
|
28
|
-
@clr_command = true
|
29
|
-
@execute_as_batch = false
|
30
|
-
@files = []
|
31
|
-
end
|
32
|
-
|
33
|
-
# Gets the configured options from the test runner configuration.
|
34
|
-
#
|
35
|
-
def opts
|
36
|
-
Map.new(
|
37
|
-
:files => files,
|
38
|
-
:copy_local => @copy_local,
|
39
|
-
:is_ms_test => @is_ms_test,
|
40
|
-
:exe => @exe,
|
41
|
-
:parameters => @parameters,
|
42
|
-
:clr_command => @clr_command,
|
43
|
-
:execute_as_batch => @execute_as_batch)
|
44
|
-
end
|
45
|
-
|
46
|
-
attr_path_accessor :settings do |s|
|
47
|
-
@parameters.add("/testsettings:#{s}")
|
48
|
-
end
|
49
|
-
|
50
|
-
# Mark that it should be possible to copy the test files local
|
51
|
-
# -- this is great if you are running a VM and the host disk is
|
52
|
-
# mapped as a network drive, which crashes some test runners
|
53
|
-
def copy_local
|
54
|
-
@copy_local = true
|
55
|
-
end
|
56
|
-
|
57
|
-
# Call this on the confiuguration if you don't want 'mono' prefixed to the
|
58
|
-
# exe path on non-windows systems.
|
59
|
-
#
|
60
|
-
def native_exe
|
61
|
-
@clr_command = false
|
62
|
-
end
|
63
|
-
|
64
|
-
def is_ms_test
|
65
|
-
@is_ms_test = true
|
66
|
-
end
|
67
|
-
|
68
|
-
# Will cause the executable to be run only once, testing all files as a batch.
|
69
|
-
def execute_as_batch
|
70
|
-
@execute_as_batch = true
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
def files
|
75
|
-
if @files.respond_to? :each
|
76
|
-
@files
|
77
|
-
else
|
78
|
-
[@files]
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
class Cmd
|
84
|
-
include CrossPlatformCmd
|
85
|
-
|
86
|
-
# expects both parameters and executable to be relative to the
|
87
|
-
# work_dir parameter
|
88
|
-
def initialize work_dir, executable, parameters, files, clr_command = true
|
89
|
-
@work_dir, @executable = work_dir, executable
|
90
|
-
if files.respond_to? :each
|
91
|
-
@parameters = files.to_a.concat(parameters.to_a)
|
92
|
-
else
|
93
|
-
@parameters = parameters.to_a.unshift(files)
|
94
|
-
end
|
95
|
-
|
96
|
-
@clr_command = clr_command
|
97
|
-
end
|
98
|
-
|
99
|
-
def execute
|
100
|
-
info { "executing in directory '#{@work_dir}'" }
|
101
|
-
system @executable,
|
102
|
-
@parameters,
|
103
|
-
:work_dir => @work_dir,
|
104
|
-
:clr_command => @clr_command
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
class Task
|
109
|
-
include Logging
|
110
|
-
|
111
|
-
def initialize opts
|
112
|
-
@opts = opts
|
113
|
-
end
|
114
|
-
|
115
|
-
def execute
|
116
|
-
raise ArgumentError, 'missing :exe' unless @opts.get :exe
|
117
|
-
raise ArgumentError, 'missing :files' unless @opts.get :files
|
118
|
-
raise ArgumentError, 'cannot specify both execute_as_batch and is_ms_test' if @opts.get :execute_as_batch and @opts.get :is_ms_test
|
119
|
-
raise ArgumentError, 'cannot specify both execute_as_batch and is_ms_test' if @opts.get :execute_as_batch and @opts.get :copy_local
|
120
|
-
|
121
|
-
@opts.get(:files).each do |dll|
|
122
|
-
raise ArgumentError, "could not find test dll '#{dll}' in dir #{FileUtils.pwd}" unless File.exists? dll
|
123
|
-
end
|
124
|
-
|
125
|
-
commands = []
|
126
|
-
if @opts.get(:execute_as_batch)
|
127
|
-
commands = build_command_for_all_dlls
|
128
|
-
else
|
129
|
-
commands = @opts.get(:files).map { |dll| build_command_for dll }
|
130
|
-
end
|
131
|
-
|
132
|
-
execute_commands commands
|
133
|
-
end
|
134
|
-
|
135
|
-
private
|
136
|
-
def execute_commands commands
|
137
|
-
commands.each { |command| command.execute }
|
138
|
-
end
|
139
|
-
|
140
|
-
def build_command_for dll
|
141
|
-
handle_directory dll, @opts.get(:exe) do |dir, exe|
|
142
|
-
filename = File.basename dll
|
143
|
-
|
144
|
-
if @opts.get(:is_ms_test)
|
145
|
-
filename = "/testcontainer:#{filename}"
|
146
|
-
end
|
147
|
-
Albacore::TestRunner::Cmd.new dir,
|
148
|
-
exe,
|
149
|
-
@opts.get(:parameters, []),
|
150
|
-
[filename],
|
151
|
-
@opts.get(:clr_command)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
def build_command_for_all_dlls
|
156
|
-
command = Albacore::TestRunner::Cmd.new '.',
|
157
|
-
@opts.get(:exe),
|
158
|
-
@opts.get(:parameters, []),
|
159
|
-
@opts.get(:files),
|
160
|
-
@opts.get(:clr_command)
|
161
|
-
[command]
|
162
|
-
end
|
163
|
-
|
164
|
-
def handle_directory dll, exe, &block
|
165
|
-
if @opts.get(:copy_local)
|
166
|
-
# TODO: #mktmpdir is not always reliable; consider contributing a patch to ruby?
|
167
|
-
# Fails sometimes with "directory already exists"
|
168
|
-
Dir.mktmpdir 'alba-test' do |dir|
|
169
|
-
sut, runners = Paths.join(dir, 'sut').to_s, Paths.join(dir, 'runners').to_s
|
170
|
-
[sut, runners].each { |d| FileUtils.mkdir_p d }
|
171
|
-
|
172
|
-
sut_glob = Paths.join(File.dirname(dll), '*').as_unix.to_s
|
173
|
-
debug { "copying recursively from #{sut_glob} [test_runner #handle_directory]" }
|
174
|
-
FileUtils.cp_r(Dir.glob(sut_glob), sut, :verbose => true)
|
175
|
-
|
176
|
-
runners_glob = Paths.join(File.dirname(exe), '*').as_unix.to_s
|
177
|
-
debug { "copying the runners form #{runners_glob} [test_runner #handle_directory]" }
|
178
|
-
FileUtils.cp_r(Dir.glob(runners_glob), runners, :verbose => true)
|
179
|
-
|
180
|
-
# call back with the new paths, easy because we have copied everything
|
181
|
-
yield [sut, Paths.join(runners, File.basename(exe)).to_s]
|
182
|
-
end
|
183
|
-
else
|
184
|
-
dir, exe =
|
185
|
-
case File.dirname dll
|
186
|
-
when /^\.\./
|
187
|
-
# if the dll is negative to this Rakefile, use absolute paths
|
188
|
-
[Pathname.new(File.absolute_path(dll)), Pathname.new(File.absolute_path(exe))]
|
189
|
-
else
|
190
|
-
# otherwise, please continue with the basics
|
191
|
-
[Paths.normalise_slashes(Pathname.new(File.dirname(dll))), Pathname.new(exe)]
|
192
|
-
end
|
193
|
-
|
194
|
-
exe_rel = (Pathname.new exe.to_s).absolute? ? exe : exe.relative_path_from(dir)
|
195
|
-
yield [File.dirname(dll), exe_rel.to_s]
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
end
|
200
|
-
end
|
data/spec/test_runner_spec.rb
DELETED
@@ -1,340 +0,0 @@
|
|
1
|
-
require 'albacore/task_types/test_runner'
|
2
|
-
require 'support/sh_interceptor'
|
3
|
-
require 'map'
|
4
|
-
|
5
|
-
describe ::Albacore::TestRunner::Config do
|
6
|
-
it do
|
7
|
-
should respond_to :opts
|
8
|
-
end
|
9
|
-
it do
|
10
|
-
should respond_to :files=
|
11
|
-
end
|
12
|
-
it do
|
13
|
-
should_not respond_to :files
|
14
|
-
end
|
15
|
-
it do
|
16
|
-
should respond_to :copy_local
|
17
|
-
end
|
18
|
-
it do
|
19
|
-
should respond_to :exe=
|
20
|
-
end
|
21
|
-
it do
|
22
|
-
should respond_to :native_exe
|
23
|
-
end
|
24
|
-
it do
|
25
|
-
should respond_to :execute_as_batch
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe ::Albacore::TestRunner::Config do
|
30
|
-
subject do
|
31
|
-
::Albacore::TestRunner::Config.new
|
32
|
-
end
|
33
|
-
|
34
|
-
before :each do
|
35
|
-
subject.add_parameter '/TestResults=/b/c/d/e.xml'
|
36
|
-
subject.native_exe
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should have the appropriate parameter in #opts.get(:parameters)' do
|
40
|
-
expect(subject.opts.get(:parameters)).to include('/TestResults=/b/c/d/e.xml')
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should have clr_command=false' do
|
44
|
-
expect(subject.opts.get(:clr_command)).to be false
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'the order of which parameters are passed', ::Albacore::TestRunner::Config do
|
49
|
-
subject do
|
50
|
-
config = ::Albacore::TestRunner::Config.new
|
51
|
-
config.files = 'a/b/c/file.dll'
|
52
|
-
config.exe = 'test-runner.exe'
|
53
|
-
config.add_parameter '/TestResults=abc.xml'
|
54
|
-
config
|
55
|
-
end
|
56
|
-
|
57
|
-
let :params do
|
58
|
-
subject.opts.get(:parameters)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'should first pass the flags' do
|
62
|
-
expect(params.first).to eq('/TestResults=abc.xml')
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should pass the file as a :files' do
|
66
|
-
expect(subject.opts.get(:files)).to eq(['a/b/c/file.dll'])
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe ::Albacore::TestRunner::Cmd do
|
71
|
-
subject do
|
72
|
-
cmd = ::Albacore::TestRunner::Cmd.new 'work_dir', 'run-tests.exe', %w[params go here], 'a/b/c/lib.tests.dll'
|
73
|
-
cmd.extend ShInterceptor
|
74
|
-
cmd.execute
|
75
|
-
cmd
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should include the parameters when executing' do
|
79
|
-
# the intersection of actual parameters with expected should eq expected
|
80
|
-
expect(subject.parameters - (subject.parameters - %w|params go here|)).
|
81
|
-
to eq(%w|params go here|)
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'should give the full path when executing' do
|
85
|
-
expect((subject.parameters - %w|params go here|)).to eq(%w|a/b/c/lib.tests.dll|)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe ::Albacore::TestRunner::Task, 'when configured improperly' do
|
90
|
-
context 'is_ms_test and execute_as_batch both specified' do
|
91
|
-
it 'should raise ArgumentError' do
|
92
|
-
config = ::Albacore::TestRunner::Config.new
|
93
|
-
config.exe = 'test-runner.exe'
|
94
|
-
config.files = 'Rakefile' # not a real DLL, but we need something that exists
|
95
|
-
config.is_ms_test
|
96
|
-
config.execute_as_batch
|
97
|
-
|
98
|
-
task = ::Albacore::TestRunner::Task.new(config.opts)
|
99
|
-
|
100
|
-
expect {
|
101
|
-
task.execute
|
102
|
-
}.to raise_error(ArgumentError)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
context 'copy_local and execute_as_batch both specified' do
|
107
|
-
it 'should raise ArgumentError' do
|
108
|
-
config = ::Albacore::TestRunner::Config.new
|
109
|
-
config.exe = 'test-runner.exe'
|
110
|
-
config.files = 'Rakefile' # not a real DLL, but we need something that exists
|
111
|
-
config.copy_local
|
112
|
-
config.execute_as_batch
|
113
|
-
|
114
|
-
task = ::Albacore::TestRunner::Task.new(config.opts)
|
115
|
-
|
116
|
-
expect {
|
117
|
-
task.execute
|
118
|
-
}.to raise_error(ArgumentError)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
describe ::Albacore::TestRunner::Task do
|
124
|
-
def create_task_that_intercepts_commands opts
|
125
|
-
task = ::Albacore::TestRunner::Task.new(config.opts)
|
126
|
-
def task.execute_commands commands
|
127
|
-
@commands = commands
|
128
|
-
commands.each { |command|
|
129
|
-
command.extend ShInterceptor
|
130
|
-
command.execute
|
131
|
-
}
|
132
|
-
end
|
133
|
-
|
134
|
-
def task.commands
|
135
|
-
@commands
|
136
|
-
end
|
137
|
-
|
138
|
-
task.execute
|
139
|
-
task
|
140
|
-
end
|
141
|
-
|
142
|
-
before(:context) do
|
143
|
-
Dir.chdir 'spec'
|
144
|
-
end
|
145
|
-
|
146
|
-
after(:context) do
|
147
|
-
Dir.chdir '..'
|
148
|
-
end
|
149
|
-
|
150
|
-
subject do
|
151
|
-
create_task_that_intercepts_commands config.opts
|
152
|
-
end
|
153
|
-
|
154
|
-
context "native_exe not specified" do
|
155
|
-
let :config do
|
156
|
-
config = ::Albacore::TestRunner::Config.new
|
157
|
-
config.exe = 'test-runner.exe'
|
158
|
-
config.files = 'utils_spec.rb' # not a real DLL, but we need something that exists
|
159
|
-
config
|
160
|
-
end
|
161
|
-
|
162
|
-
it "should execute command as CLR command" do
|
163
|
-
expect(subject.commands[0].invocations[0].options[:clr_command]).to eq(true)
|
164
|
-
end
|
165
|
-
|
166
|
-
it "should include the file at the beginning of the command" do
|
167
|
-
expect(subject.commands[0].invocations[0].parameters.first).to eq('utils_spec.rb')
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
context "native_exe specified" do
|
172
|
-
let :config do
|
173
|
-
config = ::Albacore::TestRunner::Config.new
|
174
|
-
config.exe = 'test-runner.exe'
|
175
|
-
config.files = 'utils_spec.rb' # not a real DLL, but we need something that exists
|
176
|
-
config.native_exe
|
177
|
-
config
|
178
|
-
end
|
179
|
-
|
180
|
-
it "should execute command as non-CLR command" do
|
181
|
-
expect(subject.commands[0].invocations[0].options[:clr_command]).to eq(false)
|
182
|
-
end
|
183
|
-
|
184
|
-
it "should include the file at the beginning of the command" do
|
185
|
-
expect(subject.commands[0].invocations[0].parameters.first).to eq('utils_spec.rb')
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
context "extra parameters and options specified" do
|
190
|
-
let :config do
|
191
|
-
config = ::Albacore::TestRunner::Config.new
|
192
|
-
config.exe = 'test-runner.exe'
|
193
|
-
config.files = 'utils_spec.rb' # not a real DLL, but we need something that exists
|
194
|
-
config.add_parameter '/magic_parameter1'
|
195
|
-
config.add_parameter '/magic_parameter2'
|
196
|
-
config
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should include the parameters at the end of the command" do
|
200
|
-
expect(subject.commands[0].invocations[0].parameters.last(2)).to eq(['/magic_parameter1', '/magic_parameter2'])
|
201
|
-
end
|
202
|
-
|
203
|
-
it "should include the file at the beginning of the command" do
|
204
|
-
expect(subject.commands[0].invocations[0].parameters.first).to eq('utils_spec.rb')
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
context "file is in current directory" do
|
209
|
-
let :config do
|
210
|
-
config = ::Albacore::TestRunner::Config.new
|
211
|
-
config.exe = 'test-runner.exe'
|
212
|
-
config.files = 'utils_spec.rb' # not a real DLL, but we need something that exists
|
213
|
-
config
|
214
|
-
end
|
215
|
-
|
216
|
-
it "should run the command from the current directory" do
|
217
|
-
expect(subject.commands[0].invocations[0].options[:work_dir]).to eq('.')
|
218
|
-
expect(subject.commands[0].invocations[0].executable).to eq('test-runner.exe')
|
219
|
-
end
|
220
|
-
|
221
|
-
it "should reference the file without directory qualifiers" do
|
222
|
-
expect(subject.commands[0].invocations[0].parameters).to include 'utils_spec.rb'
|
223
|
-
end
|
224
|
-
end
|
225
|
-
|
226
|
-
context "file is in subdirectory" do
|
227
|
-
let :config do
|
228
|
-
config = ::Albacore::TestRunner::Config.new
|
229
|
-
config.exe = 'test-runner.exe'
|
230
|
-
config.files = 'tools/fluent_migrator_spec.rb' # not a real DLL, but we need something that exists
|
231
|
-
config
|
232
|
-
end
|
233
|
-
|
234
|
-
it "should run the command from the subdirectory" do
|
235
|
-
expect(subject.commands[0].invocations[0].options[:work_dir]).to eq('tools')
|
236
|
-
expect(subject.commands[0].invocations[0].executable).to eq('../test-runner.exe')
|
237
|
-
end
|
238
|
-
|
239
|
-
it "should reference the file without directory qualifiers" do
|
240
|
-
expect(subject.commands[0].invocations[0].parameters).to include 'fluent_migrator_spec.rb'
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
context "file is in parent directory" do
|
245
|
-
let :config do
|
246
|
-
config = ::Albacore::TestRunner::Config.new
|
247
|
-
config.exe = 'test-runner.exe'
|
248
|
-
config.files = '../Rakefile' # not a real DLL, but we need something that exists
|
249
|
-
config
|
250
|
-
end
|
251
|
-
|
252
|
-
it "should run the command from the parent directory" do
|
253
|
-
expect(subject.commands[0].invocations[0].options[:work_dir]).to eq('..')
|
254
|
-
expect(subject.commands[0].invocations[0].executable).to eq('../spec/test-runner.exe')
|
255
|
-
end
|
256
|
-
|
257
|
-
it "should reference the file without directory qualifiers" do
|
258
|
-
expect(subject.commands[0].invocations[0].parameters).to include 'Rakefile'
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
context 'is_ms_test specified' do
|
263
|
-
let :config do
|
264
|
-
config = ::Albacore::TestRunner::Config.new
|
265
|
-
config.exe = 'test-runner.exe'
|
266
|
-
config.is_ms_test
|
267
|
-
config.files = 'utils_spec.rb' # not a real DLL, but we need something that exists
|
268
|
-
config
|
269
|
-
end
|
270
|
-
|
271
|
-
it 'should handle is_ms_test by adding testcontainer to the filename' do
|
272
|
-
expect(subject.commands.length).to eq(1)
|
273
|
-
expect(subject.commands[0].invocations[0].parameters.last).to eq('/testcontainer:utils_spec.rb')
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
context 'multiple files tested individually' do
|
278
|
-
let :config do
|
279
|
-
config = ::Albacore::TestRunner::Config.new
|
280
|
-
config.exe = 'test-runner.exe'
|
281
|
-
config.files = ['utils_spec.rb', 'tools/fluent_migrator_spec.rb'] # not real DLLs, but we need files that exist
|
282
|
-
config
|
283
|
-
end
|
284
|
-
|
285
|
-
it 'should execute one command per file' do
|
286
|
-
expect(subject.commands.length).to eq(2)
|
287
|
-
expect(subject.commands[0].invocations[0].parameters.last).to eq('utils_spec.rb')
|
288
|
-
expect(subject.commands[1].invocations[0].parameters.last).to eq('fluent_migrator_spec.rb')
|
289
|
-
end
|
290
|
-
end
|
291
|
-
|
292
|
-
context 'multiple files tested as a batch' do
|
293
|
-
let :config do
|
294
|
-
config = ::Albacore::TestRunner::Config.new
|
295
|
-
config.exe = 'test-runner.exe'
|
296
|
-
config.files = ['utils_spec.rb', 'tools/fluent_migrator_spec.rb'] # not real DLLs, but we need files that exist
|
297
|
-
config.execute_as_batch
|
298
|
-
config
|
299
|
-
end
|
300
|
-
|
301
|
-
it 'should execute a single command for all the files' do
|
302
|
-
expect(subject.commands.length).to eq(1)
|
303
|
-
expect(subject.commands[0].invocations[0].parameters).to eq(['utils_spec.rb', 'tools/fluent_migrator_spec.rb'])
|
304
|
-
end
|
305
|
-
end
|
306
|
-
end
|
307
|
-
|
308
|
-
describe ::Albacore::TestRunner::Cmd do
|
309
|
-
describe "creation" do
|
310
|
-
subject do
|
311
|
-
command = ::Albacore::TestRunner::Cmd.new '.',
|
312
|
-
'test-runner.exe',
|
313
|
-
['/parameter'],
|
314
|
-
files
|
315
|
-
command.extend ShInterceptor
|
316
|
-
command.execute
|
317
|
-
command
|
318
|
-
end
|
319
|
-
|
320
|
-
context "files is a single file" do
|
321
|
-
let :files do
|
322
|
-
'file'
|
323
|
-
end
|
324
|
-
|
325
|
-
it "should prepend the file to the parameters list" do
|
326
|
-
expect(subject.invocations[0].parameters).to eq(['file', '/parameter'])
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
context "files is an array" do
|
331
|
-
let :files do
|
332
|
-
['file1', 'file2']
|
333
|
-
end
|
334
|
-
|
335
|
-
it "should prepend the files to the parameters list" do
|
336
|
-
expect(subject.invocations[0].parameters).to eq(['file1', 'file2', '/parameter'])
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
340
|
-
end
|