test_bench-bootstrap 6.1.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/executables/bench-bootstrap +7 -0
- data/lib/test_bench_bootstrap/controls.rb +1 -0
- data/lib/test_bench_bootstrap/test_bench_bootstrap.rb +7 -0
- data/lib/test_bench_bootstrap.rb +4 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/controls/namespace.rb +84 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/controls.rb +1 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/import_constants.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/import_constants/macro.rb +10 -0
- data/upstream-lib/test_bench_bootstrap/import_constants.rb +2 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/controls/telemetry_sink.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/controls.rb +3 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/run.rb +12 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls/standard_input.rb +31 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/controls.rb +8 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/defaults.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/executable.rb +61 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable/parse_arguments.rb +271 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/executable.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/build.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/comment_style.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/exception.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/fixture.rb +69 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/message.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/output.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/session.rb +21 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/status.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/text.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls/title.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/controls.rb +14 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/evaluate.rb +37 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture/fixture.rb +213 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/fixture.rb +7 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/comment_style.rb +63 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/comment_style.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/event.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/aborted.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/commented.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_finished.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/context_started.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/detailed.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/failed.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_executed.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_not_found.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/file_queued.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/skipped.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_finished.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/events/test_started.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/session.rb +19 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/status.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/style.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls/text.rb +31 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/controls.rb +26 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/detail_policy.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/null.rb +21 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device/substitute.rb +46 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/device.rb +75 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/get.rb +32 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/level.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/output.rb +572 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/style.rb +54 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer/substitute.rb +27 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output/writer.rb +119 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/output.rb +20 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/seed.rb +25 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls/sequence.rb +70 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/controls.rb +2 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/defaults.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator/substitute.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/generator.rb +64 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/iterator.rb +54 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random/random.rb +27 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/random.rb +8 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/events.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/message.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/path.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/session.rb +16 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/status.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/info.rb +108 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file/totals.rb +38 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/file.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary/run.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/summary.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/telemetry.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls/time.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/controls.rb +20 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/run.rb +146 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files/substitute.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/select_files.rb +70 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/substitute.rb +42 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary/substitute.rb +19 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run/summary.rb +477 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/run.rb +10 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace/location.rb +48 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/backtrace.rb +83 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/comment_disposition.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/event.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/aborted.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/commented.rb +62 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_finished.rb +112 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/context_started.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/detailed.rb +62 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/failed.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_executed.rb +101 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_not_found.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/file_queued.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/skipped.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_finished.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events/test_started.rb +51 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/events.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/message.rb +23 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception/raise.rb +52 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/exception.rb +81 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/message.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/metadata.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/apex_directory.rb +76 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file/create.rb +113 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path/file.rb +42 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/path.rb +87 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/random.rb +9 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/result.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/sequence.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/status.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/telemetry_sink.rb +37 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/text.rb +33 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls/title.rb +41 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/controls.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/defaults.rb +17 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/events.rb +24 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace/substitute.rb +34 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/exception/format_backtrace.rb +114 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate/substitute.rb +45 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/isolate.rb +159 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/result.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/session.rb +236 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/status.rb +60 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute/sink.rb +99 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/substitute.rb +154 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session/trace.rb +53 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/session.rb +22 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event/metadata.rb +72 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event.rb +156 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/event_data.rb +113 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/handler.rb +83 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/path/file.rb +39 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/process_id.rb +25 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/random.rb +11 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/sink.rb +35 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls/time.rb +104 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/controls.rb +16 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event.rb +130 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data/serialization.rb +85 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/event_data.rb +15 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/file.rb +39 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler/event_registry.rb +44 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink/handler.rb +128 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/sink.rb +13 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute/sink.rb +71 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/substitute.rb +43 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry/telemetry.rb +92 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/telemetry.rb +18 -0
- data/upstream-lib/test_bench_bootstrap/test_bench/test_bench.rb +72 -0
- data/upstream-lib/test_bench_bootstrap/test_bench.rb +4 -0
- metadata +353 -16
- data/lib/test_bench/bootstrap.rb +0 -328
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bce5dfa1efc3538d7e6aaea169937603a308db3f611afe053e2f582f90fb7341
|
4
|
+
data.tar.gz: 6e846123a4d565e621c86920537a34b330aa389b543b29a49110b1cbe9c6f21c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dd22538adacd762648e0499289b81b2a51236985192059c430de7ac4e9e651ea8de319436e3013b1cce721841e40516d93a361af9f09e9dbbeb0f6e451f31df
|
7
|
+
data.tar.gz: ed43a134a45f23bad998d062c94514035a95e6df45b0a43a483f5b92d1b4e6717f2eb2c825d4dceccb39581d6d50e73e1cae95e2f2d77d23eb8c02ca7c86c36b
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'test_bench_bootstrap/test_bench/controls'
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module ImportConstants
|
3
|
+
module Controls
|
4
|
+
module Namespace
|
5
|
+
def self.example(name: nil, &block)
|
6
|
+
Example
|
7
|
+
end
|
8
|
+
|
9
|
+
module Example
|
10
|
+
module SomeConstant
|
11
|
+
end
|
12
|
+
|
13
|
+
module SomeOtherConstant
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module Anonymous
|
18
|
+
def self.example(name: nil, &block)
|
19
|
+
name ||= self.name
|
20
|
+
|
21
|
+
namespace = Module.new
|
22
|
+
namespace.set_temporary_name(name)
|
23
|
+
|
24
|
+
if not block.nil?
|
25
|
+
namespace.module_exec(&block)
|
26
|
+
end
|
27
|
+
|
28
|
+
namespace
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.name
|
32
|
+
'Some Anonymous Module'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
module Target
|
37
|
+
def self.example(name: nil, &block)
|
38
|
+
name ||= self.name
|
39
|
+
|
40
|
+
Anonymous.example(name:)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.name
|
44
|
+
'Some Target Module'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
module InheritNamespace
|
49
|
+
def self.example(namespace=nil)
|
50
|
+
namespace ||= Namespace.example
|
51
|
+
|
52
|
+
Anonymous.example(name:) do
|
53
|
+
include namespace
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.name
|
58
|
+
'Include Namespace'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
module AliasNamespace
|
63
|
+
def self.example(namespace=nil, name: nil)
|
64
|
+
namespace ||= Namespace.example
|
65
|
+
|
66
|
+
constant_names = namespace.constants(false)
|
67
|
+
|
68
|
+
Anonymous.example(name:) do
|
69
|
+
constant_names.each do |constant_name|
|
70
|
+
constant = namespace.const_get(constant_name)
|
71
|
+
|
72
|
+
const_set(constant_name, constant)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.name
|
78
|
+
'Alias Namespace'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'test_bench_bootstrap/import_constants/controls/namespace'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module ImportConstants
|
3
|
+
Error = Class.new(RuntimeError)
|
4
|
+
|
5
|
+
def self.included(target_namespace)
|
6
|
+
target_namespace.extend(Macro)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.call(source_namespace, target_namespace=nil, as: nil)
|
10
|
+
target_namespace ||= Object
|
11
|
+
alias_name = as
|
12
|
+
|
13
|
+
if not alias_name.nil?
|
14
|
+
if target_namespace.const_defined?(alias_name, false)
|
15
|
+
raise Error, "#{target_namespace}::#{alias_name} is already defined"
|
16
|
+
end
|
17
|
+
|
18
|
+
alias_module = Module.new
|
19
|
+
ImportConstants.(source_namespace, alias_module)
|
20
|
+
|
21
|
+
target_namespace.const_set(alias_name, alias_module)
|
22
|
+
|
23
|
+
else
|
24
|
+
inherit = false
|
25
|
+
constants = source_namespace.constants(inherit)
|
26
|
+
|
27
|
+
constants.each do |constant_name|
|
28
|
+
constant = source_namespace.const_get(constant_name)
|
29
|
+
|
30
|
+
if target_namespace.const_defined?(constant_name, false)
|
31
|
+
if warn?
|
32
|
+
warn "#{source_namespace}::#{constant_name} is not imported into #{target_namespace}. It is already defined."
|
33
|
+
end
|
34
|
+
next
|
35
|
+
end
|
36
|
+
|
37
|
+
target_namespace.const_set(constant_name, constant)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.warn?
|
43
|
+
ENV.fetch('IMPORT_CONSTANTS_WARNING', 'on') == 'on'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Executable
|
4
|
+
module Controls
|
5
|
+
module StandardInput
|
6
|
+
module Create
|
7
|
+
def self.call(*paths)
|
8
|
+
if paths.empty?
|
9
|
+
paths = Path.examples
|
10
|
+
end
|
11
|
+
|
12
|
+
content = <<~TEXT
|
13
|
+
#{paths.join("\n")}
|
14
|
+
TEXT
|
15
|
+
|
16
|
+
file = Session::Controls::Path::File::Create.(content)
|
17
|
+
|
18
|
+
::File.open(file, 'r')
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.contents
|
22
|
+
<<~TEXT
|
23
|
+
#{Path.example}
|
24
|
+
TEXT
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'test_bench_bootstrap/test_bench/run/controls'
|
2
|
+
|
3
|
+
require 'test_bench_bootstrap/test_bench/executable/controls/run'
|
4
|
+
|
5
|
+
require 'test_bench_bootstrap/test_bench/executable/controls/path'
|
6
|
+
require 'test_bench_bootstrap/test_bench/executable/controls/random'
|
7
|
+
|
8
|
+
require 'test_bench_bootstrap/test_bench/executable/controls/standard_input'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Executable
|
4
|
+
module Defaults
|
5
|
+
def self.path
|
6
|
+
ENV.fetch('TEST_BENCH_DEFAULT_TEST_PATH', 'test/automated')
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.program_name
|
10
|
+
$PROGRAM_NAME || 'bench'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Executable
|
4
|
+
def run
|
5
|
+
@run ||= Run::Substitute.build
|
6
|
+
end
|
7
|
+
attr_writer :run
|
8
|
+
|
9
|
+
def arguments
|
10
|
+
@arguments ||= []
|
11
|
+
end
|
12
|
+
attr_writer :arguments
|
13
|
+
|
14
|
+
def stdin
|
15
|
+
@stdin ||= STDIN
|
16
|
+
end
|
17
|
+
attr_writer :stdin
|
18
|
+
|
19
|
+
def self.build(arguments=nil, env: nil)
|
20
|
+
instance = new
|
21
|
+
|
22
|
+
arguments = ParseArguments.(arguments, env:)
|
23
|
+
instance.arguments = arguments
|
24
|
+
|
25
|
+
Run.configure(instance)
|
26
|
+
|
27
|
+
instance
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.call(arguments=nil, env: nil)
|
31
|
+
instance = build(arguments, env:)
|
32
|
+
instance.()
|
33
|
+
end
|
34
|
+
|
35
|
+
def call
|
36
|
+
result = run.() do
|
37
|
+
if not stdin.tty?
|
38
|
+
until stdin.eof?
|
39
|
+
path = stdin.gets(chomp: true)
|
40
|
+
|
41
|
+
next if path.empty?
|
42
|
+
|
43
|
+
run << path
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
arguments.each do |path|
|
48
|
+
run << path
|
49
|
+
end
|
50
|
+
|
51
|
+
if not run.ran?
|
52
|
+
run << Defaults.path
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
exit_code = result ? 0 : 1
|
57
|
+
exit_code
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,271 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
class Executable
|
4
|
+
class ParseArguments
|
5
|
+
Error = Class.new(RuntimeError)
|
6
|
+
|
7
|
+
def writer
|
8
|
+
@writer ||= Output::Writer::Substitute.build
|
9
|
+
end
|
10
|
+
attr_writer :writer
|
11
|
+
|
12
|
+
def env
|
13
|
+
@env ||= {}
|
14
|
+
end
|
15
|
+
attr_writer :env
|
16
|
+
|
17
|
+
def non_switch_arguments
|
18
|
+
@non_switch_arguments ||= []
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_reader :raw_arguments
|
22
|
+
|
23
|
+
def initialize(raw_arguments)
|
24
|
+
@raw_arguments = raw_arguments
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.build(arguments=nil, env: nil)
|
28
|
+
arguments ||= ::ARGV
|
29
|
+
env ||= ::ENV
|
30
|
+
|
31
|
+
instance = new(arguments)
|
32
|
+
|
33
|
+
instance.env = env
|
34
|
+
|
35
|
+
Output::Writer.configure(instance)
|
36
|
+
|
37
|
+
instance
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.call(arguments=nil, env: nil)
|
41
|
+
instance = build(arguments, env:)
|
42
|
+
instance.()
|
43
|
+
end
|
44
|
+
|
45
|
+
def call
|
46
|
+
loop do
|
47
|
+
switch = next_switch
|
48
|
+
|
49
|
+
case switch
|
50
|
+
when '--', nil
|
51
|
+
break
|
52
|
+
|
53
|
+
when '-a', '--abort-on-failure'
|
54
|
+
env['TEST_BENCH_ABORT_ON_FAILURE'] = 'on'
|
55
|
+
|
56
|
+
when '-x', '--exclude'
|
57
|
+
exclude_pattern = require_next_argument(switch)
|
58
|
+
|
59
|
+
env['TEST_BENCH_EXCLUDE_FILE_PATTERN'] = [
|
60
|
+
env['TEST_BENCH_EXCLUDE_FILE_PATTERN'],
|
61
|
+
exclude_pattern
|
62
|
+
].compact.join(':')
|
63
|
+
when '-X', '--no-exclude'
|
64
|
+
env['TEST_BENCH_EXCLUDE_FILE_PATTERN'] = ''
|
65
|
+
|
66
|
+
when '-s', '--strict'
|
67
|
+
env['TEST_BENCH_STRICT'] = 'on'
|
68
|
+
when '-S', '--no-strict'
|
69
|
+
env['TEST_BENCH_STRICT'] = 'off'
|
70
|
+
|
71
|
+
when '-r', '--require'
|
72
|
+
library = require_next_argument(switch)
|
73
|
+
require(library)
|
74
|
+
when '-I', '--include'
|
75
|
+
load_path = require_next_argument(switch)
|
76
|
+
if not $LOAD_PATH.include?(load_path)
|
77
|
+
$LOAD_PATH << load_path
|
78
|
+
end
|
79
|
+
|
80
|
+
when '--random-seed'
|
81
|
+
seed = require_next_argument(switch)
|
82
|
+
env['TEST_BENCH_RANDOM_SEED'] = seed
|
83
|
+
|
84
|
+
when '-b', '--omit-backtrace'
|
85
|
+
omit_pattern = require_next_argument(switch)
|
86
|
+
|
87
|
+
env['TEST_BENCH_OMIT_BACKTRACE_PATTERN'] = [
|
88
|
+
env['TEST_BENCH_OMIT_BACKTRACE_PATTERN'],
|
89
|
+
omit_pattern
|
90
|
+
].compact.join(':')
|
91
|
+
|
92
|
+
when '-d', '--detail'
|
93
|
+
env['TEST_BENCH_OUTPUT_DETAIL'] = 'on'
|
94
|
+
when '-D', '--no-detail'
|
95
|
+
env['TEST_BENCH_OUTPUT_DETAIL'] = 'off'
|
96
|
+
|
97
|
+
when '--device'
|
98
|
+
device = require_next_argument(switch)
|
99
|
+
env['TEST_BENCH_OUTPUT_DEVICE'] = device
|
100
|
+
|
101
|
+
when '-l', '--output-level'
|
102
|
+
output_level = require_next_argument(switch)
|
103
|
+
env['TEST_BENCH_OUTPUT_LEVEL'] = output_level
|
104
|
+
when '-q', '--quiet'
|
105
|
+
env['TEST_BENCH_OUTPUT_LEVEL'] = 'not-passing'
|
106
|
+
|
107
|
+
when '-o', '--output-styling'
|
108
|
+
env['TEST_BENCH_OUTPUT_STYLING'] = 'on'
|
109
|
+
when '-O', '--no-output-styling'
|
110
|
+
env['TEST_BENCH_OUTPUT_STYLING'] = 'off'
|
111
|
+
|
112
|
+
when '--no-summary'
|
113
|
+
env['TEST_BENCH_OUTPUT_SUMMARY'] = 'off'
|
114
|
+
|
115
|
+
when '-h', '--help'
|
116
|
+
writer.write(<<~TEXT)
|
117
|
+
Usage: #{Defaults.program_name} [options] [paths]
|
118
|
+
|
119
|
+
Informational Options:
|
120
|
+
Help:
|
121
|
+
-h, --help
|
122
|
+
Print this help message and exit immediately
|
123
|
+
|
124
|
+
Execution Options:
|
125
|
+
Abort On Failure:
|
126
|
+
-a, --abort-on-failure
|
127
|
+
Stops execution if a test fails or a test file aborts
|
128
|
+
|
129
|
+
Exclude File Patterns:
|
130
|
+
-x, --exclude PATTERN
|
131
|
+
Exclude test files that match PATTERN
|
132
|
+
If multiple --exclude arguments are supplied, then files that match any will be excluded
|
133
|
+
-X, --no-exclude
|
134
|
+
Don't exclude any files
|
135
|
+
Default: '*_init.rb'
|
136
|
+
|
137
|
+
Strict:
|
138
|
+
-s, --strict
|
139
|
+
Prohibit skipped tests and contexts, and require at least one test to be performed
|
140
|
+
-S, --no-strict
|
141
|
+
Relax strictness
|
142
|
+
Default: non strict, unless TEST_BENCH_STRICT is set to 'on'
|
143
|
+
|
144
|
+
Require Library:
|
145
|
+
-r, --require LIBRARY
|
146
|
+
Require LIBRARY before running any files
|
147
|
+
-I, --include DIR
|
148
|
+
Add DIR to the load path
|
149
|
+
|
150
|
+
Random Seed:
|
151
|
+
--random-seed SEED
|
152
|
+
Pseudorandom number seed
|
153
|
+
|
154
|
+
Output Options:
|
155
|
+
Backtrace Formatting:
|
156
|
+
-b, --omit-backtrace PATTERN
|
157
|
+
Omits backtrace frames that match PATTERN
|
158
|
+
If multiple --omit-backtrace arguments are supplied, then frames that match any will be omitted
|
159
|
+
|
160
|
+
Detail:
|
161
|
+
-d, --detail
|
162
|
+
Always show details
|
163
|
+
-D, --no-detail
|
164
|
+
Never show details
|
165
|
+
Default: print details when their surrounding context failed, unless TEST_DETAIL is set to 'on' or 'off'
|
166
|
+
|
167
|
+
Device:
|
168
|
+
--device DEVICE
|
169
|
+
stderr: redirect output to standard error
|
170
|
+
null: don't write any output
|
171
|
+
Default: stdout
|
172
|
+
|
173
|
+
Verbosity:
|
174
|
+
-l, --output-level LEVEL
|
175
|
+
all: print output from every file
|
176
|
+
not-passing: print output from files that skip tests and contexts or don't perform any tests
|
177
|
+
failure: print output only from files that failed or aborted
|
178
|
+
abort: print output only from file that aborted
|
179
|
+
-q, --quiet
|
180
|
+
Sets output verbosity level to 'not-passing'
|
181
|
+
Default: all
|
182
|
+
|
183
|
+
Styling:
|
184
|
+
-o, --output-styling
|
185
|
+
Enable output text styling
|
186
|
+
-O, --no-output-styling
|
187
|
+
Disable output text styling
|
188
|
+
Default: enabled if the output device is an interactive terminal
|
189
|
+
|
190
|
+
Summary:
|
191
|
+
--no-summary
|
192
|
+
Don't print summary after running files
|
193
|
+
|
194
|
+
Paths to test files (and directories containing test files) can be given after any command line arguments or via STDIN (or both).
|
195
|
+
|
196
|
+
If no paths are given, the directory '#{Defaults.path}' is scanned for test files.
|
197
|
+
|
198
|
+
The following environment variables can also control execution:
|
199
|
+
|
200
|
+
TEST_BENCH_ABORT_ON_FAILURE See --abort-on-failure
|
201
|
+
TEST_BENCH_EXCLUDE_FILE_PATTERN See --exclude
|
202
|
+
TEST_BENCH_OUTPUT_SUMMARY See --no-summary
|
203
|
+
TEST_BENCH_STRICT See --strict
|
204
|
+
TEST_BENCH_RANDOM_SEED See --random-seed
|
205
|
+
TEST_BENCH_FILTER_BACKTRACE_PATTERN See --filter-backtrace
|
206
|
+
TEST_BENCH_OUTPUT_DETAIL See --detail
|
207
|
+
TEST_BENCH_OUTPUT_DEVICE See --device
|
208
|
+
TEST_BENCH_OUTPUT_LEVEL See --output-level
|
209
|
+
TEST_BENCH_OUTPUT_STYLING See --output-styling
|
210
|
+
TEST_BENCH_DEFAULT_TEST_PATH Specifies default path
|
211
|
+
|
212
|
+
TEXT
|
213
|
+
exit(true)
|
214
|
+
|
215
|
+
else
|
216
|
+
raise Error, "Incorrect switch #{switch}"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
remaining_arguments
|
221
|
+
end
|
222
|
+
|
223
|
+
def remaining_arguments
|
224
|
+
non_switch_arguments + raw_arguments
|
225
|
+
end
|
226
|
+
alias :arguments :remaining_arguments
|
227
|
+
|
228
|
+
def require_next_argument(switch_text)
|
229
|
+
argument = next_argument
|
230
|
+
|
231
|
+
if argument.nil?
|
232
|
+
raise Error, "Switch #{switch_text} requires an argument"
|
233
|
+
end
|
234
|
+
|
235
|
+
argument
|
236
|
+
end
|
237
|
+
|
238
|
+
def next_argument
|
239
|
+
next_argument = raw_arguments.shift
|
240
|
+
|
241
|
+
if next_argument.nil?
|
242
|
+
nil
|
243
|
+
elsif switch?(next_argument)
|
244
|
+
raw_arguments.unshift(next_argument)
|
245
|
+
nil
|
246
|
+
else
|
247
|
+
next_argument
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def next_switch
|
252
|
+
until raw_arguments.empty?
|
253
|
+
argument = raw_arguments.shift
|
254
|
+
|
255
|
+
if switch?(argument)
|
256
|
+
return argument
|
257
|
+
end
|
258
|
+
|
259
|
+
non_switch_arguments << argument
|
260
|
+
end
|
261
|
+
|
262
|
+
nil
|
263
|
+
end
|
264
|
+
|
265
|
+
def switch?(argument)
|
266
|
+
argument.start_with?('-')
|
267
|
+
end
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module TestBenchBootstrap
|
2
|
+
module TestBench
|
3
|
+
module Fixture
|
4
|
+
module Build
|
5
|
+
Error = ::Class.new(RuntimeError)
|
6
|
+
|
7
|
+
def self.call(fixture_class, *, test_session: nil, **, &)
|
8
|
+
assure_fixture(fixture_class)
|
9
|
+
|
10
|
+
if fixture_class.respond_to?(:build)
|
11
|
+
constructor = :build
|
12
|
+
else
|
13
|
+
constructor = :new
|
14
|
+
end
|
15
|
+
|
16
|
+
fixture = fixture_class.public_send(constructor, *, **, &)
|
17
|
+
|
18
|
+
Session.configure(
|
19
|
+
fixture,
|
20
|
+
session: test_session,
|
21
|
+
attr_name: :test_session
|
22
|
+
)
|
23
|
+
|
24
|
+
fixture
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.assure_fixture(fixture_class)
|
28
|
+
is_class = fixture_class.instance_of?(::Class)
|
29
|
+
if not is_class
|
30
|
+
raise Error, "Not a class (Class: #{fixture_class})"
|
31
|
+
end
|
32
|
+
|
33
|
+
is_fixture_class = fixture_class.included_modules.include?(Fixture)
|
34
|
+
if not is_fixture_class
|
35
|
+
raise Error, "Not a fixture class (Class: #{fixture_class})"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|