tla-trace-arch 0.1.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 +7 -0
- data/README.org +158 -0
- data/VERSION +1 -0
- data/mustache/api-call-after-state-post.mustache +10 -0
- data/mustache/api-call-after-state-pre.mustache +10 -0
- data/mustache/api-call-before-state-post.mustache +10 -0
- data/mustache/api-call-before-state-pre.mustache +10 -0
- data/mustache/api-call-call-post.mustache +10 -0
- data/mustache/api-call-call-pre.mustache +10 -0
- data/mustache/api-call-header.mustache +7 -0
- data/mustache/api-call-init.mustache +33 -0
- data/mustache/api-call-link.mustache +9 -0
- data/mustache/api-call-post.mustache +7 -0
- data/mustache/api-call-pre.mustache +13 -0
- data/mustache/api-call-ret-post.mustache +10 -0
- data/mustache/api-call-ret-pre.mustache +10 -0
- data/mustache/api-call-step-post.mustache +11 -0
- data/mustache/api-call-step-pre.mustache +16 -0
- data/mustache/arch-call-script.mustache +268 -0
- data/mustache/arch-demo-afterState.mustache +7 -0
- data/mustache/arch-demo-api_input.mustache +6 -0
- data/mustache/arch-demo-api_return.mustache +6 -0
- data/mustache/arch-demo-beforeState.mustache +9 -0
- data/tla-trace-arch.gemspec +64 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9881430239c5bc604dcd31251f5d3d4f77f5cc50
|
4
|
+
data.tar.gz: 6ec39a64cbf83df55b596fd361cd477676a72cb9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f48c2e3b8ae5dddb60c2c1cda737d396c6333976929130d094347c9d6e47c3c17a0c1399b24eb5771b7bb092849e150ce7c10192b7e8355e3de8e860a70f3684
|
7
|
+
data.tar.gz: 5241e5d5ba18f984fba05eecdf1953dc8b104f25520051000cf7a3c93e3375815aebf2dd7316a7421b320730e5a376b1b03abeea9d4c956a00130fa6823dfc11
|
data/README.org
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
* =tla-trace-arch= - Create a self extracting archive for Sbuilder API trace
|
2
|
+
|
3
|
+
A set of [[https://mustache.github.io/mustache.5.html][mustache]] templates extending [[https://github.com/jarjuk/tla-trace-filter][tla-trace-filter]] -tool to create
|
4
|
+
a self extracting achieve for API traces generated, when [[http://research.microsoft.com/en-us/um/people/lamport/tla/tools.html][model
|
5
|
+
checking]] formal models created by [[https://github.com/jarjuk/tla-sbuilder][Sbuilder]] -tool.
|
6
|
+
|
7
|
+
** Use case
|
8
|
+
|
9
|
+
Formal models, built using [[https://github.com/jarjuk/tla-sbuilder][tla-sbuilder]], and model checked using
|
10
|
+
[[http://research.microsoft.com/en-us/um/people/lamport/tla/tools.html][TLA+tools]], can generate /API Traces/, which represent end-to-end
|
11
|
+
scenarios executing across system services in the formal model. An API
|
12
|
+
Trace is composed of steps, with each step giving 1) a (formal) system
|
13
|
+
state before the API call, 2) the API call exercised together with
|
14
|
+
(formal model) value bindings of request parameters, 3) API response
|
15
|
+
returned, and 4) the (formal) system state after the API call. An API
|
16
|
+
Trace can be mapped to /Unit Tests/ on implementation with each Unit
|
17
|
+
Test corresponding a step in the API Trace. After executing each of
|
18
|
+
the individual Unit Tests, the aggregate result can be interpreted as
|
19
|
+
an execution of a "virtual" System Test - considerably easier than
|
20
|
+
managing the execution a System Test as a single unit.
|
21
|
+
|
22
|
+
The purpose of =tla-trace-arch= GEM is create a self extracting
|
23
|
+
archive, which can be safely distributed to system service developers
|
24
|
+
for extracting API Trace Steps to create unit tests for the service
|
25
|
+
being developed by the developer.
|
26
|
+
|
27
|
+
** Features
|
28
|
+
|
29
|
+
|
30
|
+
- Archive meta data
|
31
|
+
- [X] SHA1 hash to guarantee achieve integrity
|
32
|
+
- [X] Archive creation time stamp, hostname and userid
|
33
|
+
- [ ] Name of property generating API Trace
|
34
|
+
- Archive content for each Api Trace Step
|
35
|
+
- [X] Before state
|
36
|
+
- [X] Name of interface operation and parameter values
|
37
|
+
- [X] Return values and return status
|
38
|
+
- [X] After state
|
39
|
+
- Archive commands
|
40
|
+
- [X] Help
|
41
|
+
- [X] List steps
|
42
|
+
- [X] Extract by step number
|
43
|
+
- [X] Extract by interface name
|
44
|
+
- Archive options
|
45
|
+
- [X] Define target directory for achieve extract
|
46
|
+
- Extension points
|
47
|
+
- [X] Control content of Api Trace Step elements per interface name
|
48
|
+
|
49
|
+
|
50
|
+
*Notice*: Unchecked boxes have not yet been implemented.
|
51
|
+
|
52
|
+
Ref also [[https://cucumber.io/][Cucumber]] tests in directory [[./features][features]].
|
53
|
+
|
54
|
+
** Installation
|
55
|
+
|
56
|
+
Create GEM file with the content
|
57
|
+
|
58
|
+
#+BEGIN_SRC ruby :eval no :exports code
|
59
|
+
source "https://rubygems.org"
|
60
|
+
gem "tla-trace-arch"
|
61
|
+
#+END_SRC
|
62
|
+
|
63
|
+
and run
|
64
|
+
|
65
|
+
#+BEGIN_SRC sh :eval no :results output
|
66
|
+
bundle install
|
67
|
+
#+END_SRC
|
68
|
+
|
69
|
+
** Usage
|
70
|
+
|
71
|
+
=tla-trace-filter= uses TLA+tools model checker log output and a YAML
|
72
|
+
file mapping model checker log output to application interfaces.
|
73
|
+
|
74
|
+
For example, generating a formal model using =sbuilder= for =setup1=
|
75
|
+
with the command
|
76
|
+
|
77
|
+
#+name: sbuilder-gen
|
78
|
+
#+BEGIN_SRC sh :eval no :results output :exports code
|
79
|
+
bundle exec sbuilder.rb generate setup1
|
80
|
+
#+END_SRC
|
81
|
+
|
82
|
+
creates a YAML file =gen/$SETUP/tla/interfaces.yaml=, which allows
|
83
|
+
=tla-trace-filter= to map model checker log output to application
|
84
|
+
interfaces.
|
85
|
+
|
86
|
+
Using the commands below to model check the formal model, generated by
|
87
|
+
sbuilder, creates a file =gen/$SETUP/tlc.out=.
|
88
|
+
|
89
|
+
#+BEGIN_SRC sh :eval no :results output :exports code
|
90
|
+
(SETUP=setup1;export TLATOOLS_JAR=$(pwd)/java/tla2tools.jar; cd gen/$SETUP/tla && java -cp $TLATOOLS_JAR pcal.trans model)
|
91
|
+
(SETUP=setup1;export TLATOOLS_JAR=$(pwd)/java/tla2tools.jar; cd gen/$SETUP/tla && java -cp $TLATOOLS_JAR tlc2.TLC possible_bank_executed | tee ../tlc.out )
|
92
|
+
#+END_SRC
|
93
|
+
|
94
|
+
If the model checker finds a violation of property, it outputs a trace
|
95
|
+
of states leading to state violating the property. API calls leading
|
96
|
+
to the error state can be inspected with the command
|
97
|
+
|
98
|
+
#+BEGIN_SRC sh :eval no :results output :exports both
|
99
|
+
export SETUP=setup1; bundle exec tla-trace-filter.rb api-calls $SETUP --src-dir . --solc-line
|
100
|
+
#+END_SRC
|
101
|
+
|
102
|
+
and an self extracting archive created with the command:
|
103
|
+
|
104
|
+
#+name: api-arch
|
105
|
+
#+BEGIN_SRC sh :eval no :results output
|
106
|
+
export SETUP=setup1; bundle exec tla-trace-filter.rb api-calls $SETUP --src-dir . --solc-line --mustache tla-trace-arch | tee arch.sh
|
107
|
+
chmod +x arch.sh
|
108
|
+
#+END_SRC
|
109
|
+
|
110
|
+
To show instructions for using the archive run
|
111
|
+
|
112
|
+
#+name: exe-arch
|
113
|
+
#+Begin_SRC sh :eval no :results output :exports both
|
114
|
+
./arch.sh
|
115
|
+
#+END_SRC
|
116
|
+
|
117
|
+
and observe
|
118
|
+
|
119
|
+
#+RESULTS: exe-arch
|
120
|
+
#+begin_example
|
121
|
+
|
122
|
+
Self extracting archive created on 2017-12-27 10:05:15 by jj@horsti
|
123
|
+
|
124
|
+
$ usage
|
125
|
+
./arch.sh [options] cmd
|
126
|
+
|
127
|
+
cmd:
|
128
|
+
- step STEP : extract files for STEP#
|
129
|
+
- interface INTERFACE : extract files for INTERFACE
|
130
|
+
- list [INTERFACE] : list steps matching INTERFACE, all if not given
|
131
|
+
|
132
|
+
options:
|
133
|
+
--dir DIR | -d DIR : extract into directory DIR=tmp
|
134
|
+
--help : output this message
|
135
|
+
--awk-debug : output debug message from awk extract
|
136
|
+
|
137
|
+
Notice 1: STEP and INTERFACE parameters are treated as regexps,
|
138
|
+
and regexp special characters must be escaped with backslash
|
139
|
+
character.
|
140
|
+
|
141
|
+
Notice 2: Backslash characters must also be escaped. In effect,
|
142
|
+
use double backslash characters for escaping.
|
143
|
+
|
144
|
+
|
145
|
+
#+end_example
|
146
|
+
|
147
|
+
For a complete example, starting with installation of sbuilder- tool
|
148
|
+
and with creating a formal model, refer [[./test-trace.org][test-trace.org]].
|
149
|
+
|
150
|
+
** Extension point =api-call-init=
|
151
|
+
|
152
|
+
These templates work with [[https://github.com/jarjuk/tla-trace-filter#api-call-init-extension-point][api-call-init extension point]] allowing to
|
153
|
+
create interface specific archive content.
|
154
|
+
|
155
|
+
** License
|
156
|
+
|
157
|
+
MIT
|
158
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,33 @@
|
|
1
|
+
{{!
|
2
|
+
|
3
|
+
Override api-call-init.mustache in tla-trace-filter GEM
|
4
|
+
|
5
|
+
}}
|
6
|
+
{{#API_BEFORE_STATE_INIT}}
|
7
|
+
default: arch-demo-beforeState
|
8
|
+
{{/API_BEFORE_STATE_INIT}}{{!
|
9
|
+
|
10
|
+
Configure templates to render API CALL
|
11
|
+
|
12
|
+
}}{{#API_CALL_INIT}}
|
13
|
+
default: arch-demo-api_input
|
14
|
+
{{/API_CALL_INIT}}{{!
|
15
|
+
|
16
|
+
Configure templates to render API_RETURN
|
17
|
+
|
18
|
+
}}{{#API_RETURN_INIT}}
|
19
|
+
default: arch-demo-api_return
|
20
|
+
{{/API_RETURN_INIT}}{{!
|
21
|
+
|
22
|
+
Configure templates to render state after API call
|
23
|
+
|
24
|
+
}}{{#API_AFTER_STATE_INIT}}
|
25
|
+
default: arch-demo-afterState
|
26
|
+
{{/API_AFTER_STATE_INIT}}{{!
|
27
|
+
|
28
|
+
Do not output new-line
|
29
|
+
|
30
|
+
Local Variables:
|
31
|
+
require-final-newline: nil
|
32
|
+
End:
|
33
|
+
}}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{{!
|
2
|
+
|
3
|
+
api-call-step-pre.mustache: Override this template to change wrapping around api-calls
|
4
|
+
Line __START_OF_STEP__ used to trigger extraction
|
5
|
+
Fields names extracted: now, interface, interface-implementation
|
6
|
+
Fields names must be followed by '=' -charecter
|
7
|
+
Fields value must be followed by '\t' TAB -charecter
|
8
|
+
|
9
|
+
|
10
|
+
}}__START_OF_STEP__ now={{now}} interface={{interface.interface_operation}} interface-implementation={{interface.implementation}}
|
11
|
+
jsust one lihe in st step {{now}} {{interface.interface_operation}}
|
12
|
+
{{!
|
13
|
+
Local Variables:
|
14
|
+
require-final-newline: nil
|
15
|
+
End:
|
16
|
+
}}
|
@@ -0,0 +1,268 @@
|
|
1
|
+
{{!
|
2
|
+
|
3
|
+
arch-call-script.mustache: self extracting stcript
|
4
|
+
|
5
|
+
|
6
|
+
}}
|
7
|
+
#!/bin/bash
|
8
|
+
|
9
|
+
echo ""
|
10
|
+
echo "Self extracting archive created on {{META.timestamp}} by {{META.user}}@{{META.hostname}}"
|
11
|
+
echo ""
|
12
|
+
|
13
|
+
# functions
|
14
|
+
usage() {
|
15
|
+
echo $ usage
|
16
|
+
|
17
|
+
cat <<EOF
|
18
|
+
$0 [options] cmd
|
19
|
+
|
20
|
+
cmd:
|
21
|
+
- step STEP : extract files for STEP#
|
22
|
+
- interface INTERFACE : extract files for INTERFACE
|
23
|
+
- list [INTERFACE] : list steps matching INTERFACE, all if not given
|
24
|
+
|
25
|
+
options:
|
26
|
+
--dir DIR | -d DIR : extract into directory DIR=$EXTRACT_DIR
|
27
|
+
--help : output this message
|
28
|
+
--awk-debug : output debug message from awk extract
|
29
|
+
|
30
|
+
Notice 1: STEP and INTERFACE parameters are treated as regexps,
|
31
|
+
and regexp special characters must be escaped with backslash
|
32
|
+
character.
|
33
|
+
|
34
|
+
Notice 2: Backslash characters must also be escaped. In effect,
|
35
|
+
use double backslash characters for escaping.
|
36
|
+
|
37
|
+
|
38
|
+
EOF
|
39
|
+
exit 1
|
40
|
+
}
|
41
|
+
|
42
|
+
# Validate SHA1 between lines 1-'endOfArchive' of 'file' equals 'sha1Archive'
|
43
|
+
checkSha1() {
|
44
|
+
local file=$1; shift
|
45
|
+
local endOfArchive=$1; shift
|
46
|
+
local sha1Archive=$1; shift
|
47
|
+
|
48
|
+
local sha1Calculated=$(cat $file | sed "1,$endOfArchive!d" | sha1sum | cut -f1 -d' ' )
|
49
|
+
|
50
|
+
echo ".. Checking SHA1 of $file" >&2
|
51
|
+
if [ "$sha1Archive" != "$sha1Calculated" ]; then
|
52
|
+
echo "SHA1 sum calculated '$sha1Calculated' does not match SHA1 in archive '$sha1Archive' - archive corrupted - exiting" >&2
|
53
|
+
exit 1
|
54
|
+
fi
|
55
|
+
echo ".. Archive SHA1 ok" >&2
|
56
|
+
}
|
57
|
+
|
58
|
+
# Extract 'step' or for steps for 'interface' from 'file' into files
|
59
|
+
# 'extractFileName' in 'extract_dir' where file name given by
|
60
|
+
extract() {
|
61
|
+
|
62
|
+
local cmd=$1; shift
|
63
|
+
local file=$1; shift
|
64
|
+
local step=$1; shift
|
65
|
+
local interface=$1; shift
|
66
|
+
local sha1Archive=$1; shift
|
67
|
+
|
68
|
+
if [ ! -d $EXTRACT_DIR ]; then
|
69
|
+
cat <<EOF >&2
|
70
|
+
Incorrect extraction directory=$EXTRACT_DIR - exiting
|
71
|
+
|
72
|
+
Hint: set directory using --dir option
|
73
|
+
EOF
|
74
|
+
exit 1
|
75
|
+
fi
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
echo ".. $cmd step=$step, interface=$interface" >&2
|
80
|
+
awk -v cmd=$cmd -v sha1Archive=$sha1Archive -v extract_dir=$EXTRACT_DIR -v awk_debug=$AWK_DEBUG -v step=$step -v interface=$interface '
|
81
|
+
function dbg( msg ){
|
82
|
+
if ( length( awk_debug) > 0 ) {
|
83
|
+
print msg
|
84
|
+
}
|
85
|
+
}
|
86
|
+
function escape_pattern(pat, safe) {
|
87
|
+
safe = pat
|
88
|
+
gsub(/[][^$.*?+{}\\()|]/, "\\\\&", safe)
|
89
|
+
return safe
|
90
|
+
}
|
91
|
+
# @return [String] name of of file where to extract
|
92
|
+
function extractFileName( dir, prefix ) {
|
93
|
+
# current_step using 3 digits
|
94
|
+
return dir "/" sprintf("%03d", current_step) "-" prefix "-" current_interface_implementation "-" sha1Archive
|
95
|
+
}
|
96
|
+
BEGIN {
|
97
|
+
extract_file=""
|
98
|
+
dbg( "starting step" step )
|
99
|
+
# step_start identify steps to work upon
|
100
|
+
step_start="^__START_OF_STEP__"
|
101
|
+
if ( length(interface) == 0 ) {
|
102
|
+
step_start= step_start ".*now=" step
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
# step_start= step_start ".*interface=" escape_pattern(interface,interface)
|
106
|
+
step_start= step_start ".*interface=" interface
|
107
|
+
}
|
108
|
+
dbg( "step_start=" step_start " for interface=" interface )
|
109
|
+
# identify rules
|
110
|
+
step_end="^__END_OF_STEP__"
|
111
|
+
beforeState_start="^__START_OF_BEFORE_STATE__"
|
112
|
+
beforeState_end="^__END_OF_BEFORE_STATE__"
|
113
|
+
api_call_start="^__START_OF_STEP_API_CALL__"
|
114
|
+
api_call_end="^__END_OF_STEP_API_CALL__"
|
115
|
+
api_return_start="^__START_OF_STEP_API_RETURN__"
|
116
|
+
api_return_end="^__END_OF_STEP_API_RETURN__"
|
117
|
+
afterState_start="^__START_OF_AFTER_STATE__"
|
118
|
+
afterState_end="^__END_OF_AFTER_STATE__"
|
119
|
+
in_step=0
|
120
|
+
}
|
121
|
+
# activate step
|
122
|
+
match( $0, step_start) {
|
123
|
+
dbg( "step starteted" $0 )
|
124
|
+
in_step=1
|
125
|
+
# extract fields from Start of step line
|
126
|
+
match( $0, /now=([^\t]+)/, parsed )
|
127
|
+
current_step = parsed[1]
|
128
|
+
match( $0, /interface=([^\t]+)/, parsed )
|
129
|
+
current_interface = parsed[1]
|
130
|
+
match( $0, /interface-implementation=([^\t]+)/, parsed )
|
131
|
+
current_interface_implementation = parsed[1]
|
132
|
+
# step_start line consumed read next line
|
133
|
+
print "Step " current_step " interface " current_interface >"/dev/stderr"
|
134
|
+
next # getline
|
135
|
+
}
|
136
|
+
match( $0, step_end) {
|
137
|
+
in_step=0
|
138
|
+
}
|
139
|
+
# choose extract file
|
140
|
+
in_step && match( $0, beforeState_start ) {
|
141
|
+
extract_file = extractFileName( extract_dir, "01-inp" )
|
142
|
+
print "" > extract_file
|
143
|
+
dbg( "in_step && beforeState_start:" $0 ", extract_file=" extract_file)
|
144
|
+
next # getline
|
145
|
+
}
|
146
|
+
in_step && match( $0, api_call_start ) {
|
147
|
+
extract_file = extractFileName( extract_dir, "02-api" )
|
148
|
+
print "" > extract_file
|
149
|
+
dbg( "in_step && api_call_start:" $0 ", extract_file=" extract_file )
|
150
|
+
next # getline
|
151
|
+
}
|
152
|
+
in_step && match( $0, api_return_start ) {
|
153
|
+
extract_file = extractFileName( extract_dir, "03-ret" )
|
154
|
+
print "" > extract_file
|
155
|
+
dbg( "in_step && api_return_start:" $0 ", extract_file=" extract_file )
|
156
|
+
next # getline
|
157
|
+
}
|
158
|
+
in_step && match( $0, afterState_start ) {
|
159
|
+
extract_file = extractFileName( extract_dir, "04-out" )
|
160
|
+
print "" > extract_file
|
161
|
+
dbg( "in_step && afterState_start:" $0 ", extract_file=" extract_file )
|
162
|
+
next # getline
|
163
|
+
}
|
164
|
+
# quit extracting
|
165
|
+
length(extract_file) > 0 && match( $0, beforeState_end ) {
|
166
|
+
extract_file=""
|
167
|
+
dbg( "in_step && beforeState_end:" $0 )
|
168
|
+
next # getline
|
169
|
+
}
|
170
|
+
length(extract_file) > 0 && match( $0, api_call_end ) {
|
171
|
+
extract_file=""
|
172
|
+
dbg( "in_step && api_call_end:" $0 )
|
173
|
+
next # getline
|
174
|
+
}
|
175
|
+
length(extract_file) > 0 && match( $0, api_return_end ) {
|
176
|
+
extract_file=""
|
177
|
+
dbg( "in_step && api_return_end:" $0 )
|
178
|
+
next # getline
|
179
|
+
}
|
180
|
+
length(extract_file) > 0 && match( $0, afterState_end ) {
|
181
|
+
extract_file=""
|
182
|
+
dbg( "in_step && afterState_end:" $0 )
|
183
|
+
next # getline
|
184
|
+
}
|
185
|
+
# extract?
|
186
|
+
cmd != "list" && length(extract_file) > 0 {
|
187
|
+
print $0 >> extract_file
|
188
|
+
}
|
189
|
+
# done
|
190
|
+
END {
|
191
|
+
dbg( "end" )
|
192
|
+
}
|
193
|
+
|
194
|
+
' $file
|
195
|
+
}
|
196
|
+
|
197
|
+
# Default options
|
198
|
+
A_VERSION=1.0.0
|
199
|
+
AWK_DEBUG=""
|
200
|
+
EXTRACT_DIR="."
|
201
|
+
# Option
|
202
|
+
|
203
|
+
while true
|
204
|
+
do
|
205
|
+
case "$1" in
|
206
|
+
--version | -v)
|
207
|
+
echo Archive version $A_VERSION
|
208
|
+
exit 0
|
209
|
+
;;
|
210
|
+
--awk-debug)
|
211
|
+
AWK_DEBUG=1
|
212
|
+
shift
|
213
|
+
;;
|
214
|
+
--dir | -d )
|
215
|
+
shift
|
216
|
+
EXTRACT_DIR=$1
|
217
|
+
shift
|
218
|
+
;;
|
219
|
+
--debug)
|
220
|
+
set -x
|
221
|
+
shift
|
222
|
+
;;
|
223
|
+
-h | --help)
|
224
|
+
usage
|
225
|
+
;;
|
226
|
+
*)
|
227
|
+
break
|
228
|
+
;;
|
229
|
+
esac
|
230
|
+
done
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
# Extract
|
235
|
+
# ARCHIVE_START=$(awk '/^__START_OF_PAY_LOAD__/ {print NR + 1; exit 0; }' $0)
|
236
|
+
ARCHIVE_END=$(awk '/^__END_OF_PAY_LOAD__/ {print NR -1; exit 0; }' $0)
|
237
|
+
SHA1_ARCHIVE=$(tail -1 $0)
|
238
|
+
|
239
|
+
checkSha1 $0 $ARCHIVE_END $SHA1_ARCHIVE
|
240
|
+
|
241
|
+
case "$1" in
|
242
|
+
|
243
|
+
step)
|
244
|
+
shift
|
245
|
+
extract step $0 "$1" "" $SHA1_ARCHIVE
|
246
|
+
shift
|
247
|
+
;;
|
248
|
+
|
249
|
+
list)
|
250
|
+
shift
|
251
|
+
P1=$1; shift
|
252
|
+
extract list $0 "" "$P1" $SHA1_ARCHIVE
|
253
|
+
;;
|
254
|
+
|
255
|
+
interface)
|
256
|
+
shift
|
257
|
+
extract interface $0 "" "$1" $SHA1_ARCHIVE
|
258
|
+
shift
|
259
|
+
;;
|
260
|
+
|
261
|
+
*)
|
262
|
+
usage
|
263
|
+
;;
|
264
|
+
esac
|
265
|
+
|
266
|
+
|
267
|
+
exit 0
|
268
|
+
__START_OF_PAY_LOAD__
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- encoding: utf-8; mode: ruby -*-
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib/', __FILE__)
|
4
|
+
$:.unshift lib unless $:.include?(lib)
|
5
|
+
|
6
|
+
|
7
|
+
# http://guides.rubygems.org/make-your-own-gem/
|
8
|
+
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
|
11
|
+
# version = "0.0.1.pre"
|
12
|
+
version = File.open( "VERSION", "r" ) { |f| f.read }.strip.gsub( "-SNAPSHOT", ".pre" )
|
13
|
+
|
14
|
+
s.name = 'tla-trace-arch'
|
15
|
+
s.version = version
|
16
|
+
s.date = Time.now.strftime( "%Y-%m-%d" ) #'2014-09-10'
|
17
|
+
s.summary = "Mustache templates to create self extracing archieve for Sbuilder API-trace"
|
18
|
+
s.description =
|
19
|
+
<<EOF
|
20
|
+
|
21
|
+
A set of [mustache] templates extending [tla-trace-filter] -tool
|
22
|
+
to create a self extracting achieve for API traces generated, when
|
23
|
+
model checking formal models created by [tla-Sbuilder] -tool.
|
24
|
+
|
25
|
+
Use case:
|
26
|
+
|
27
|
+
Formal models, built using [tla-sbuilder], and model checked using
|
28
|
+
[TLA+tools]], can generate /API Traces/, which represent
|
29
|
+
end-to-end scenarios executing across system services in the
|
30
|
+
formal model. An API Trace is composed of steps, with each step
|
31
|
+
giving 1) a (formal) system state before the API call, 2) the API
|
32
|
+
call exercised together with (formal model) value bindings of
|
33
|
+
request parameters, 3) API response returned, and 4) the (formal)
|
34
|
+
system state after the API call. A API Trace can be mapped to
|
35
|
+
/Unit Tests/ on implementation with each Unit Test corresponding a
|
36
|
+
step in the API Trace. After executing each of the individual Unit
|
37
|
+
Tests, the aggregate result can be interpreted as an execution of
|
38
|
+
a "virtual" System Test - considerably easier than managing the
|
39
|
+
execution a System Test as a single unit.
|
40
|
+
|
41
|
+
The purpose of =tla-trace-arch= GEM is create a self extracting
|
42
|
+
archive, which can be safely distributed to system service
|
43
|
+
developers for extracting API Trace Steps to create unit tests for
|
44
|
+
the service being developed by the developer.
|
45
|
+
|
46
|
+
|
47
|
+
Ref:
|
48
|
+
- https://github.com/jarjuk/tla-trace-filter
|
49
|
+
- https://mustache.github.io/mustache.5.html
|
50
|
+
- https://github.com/jarjuk/tla-sbuilder
|
51
|
+
- http://research.microsoft.com/en-us/um/people/lamport/tla/tools.html
|
52
|
+
EOF
|
53
|
+
|
54
|
+
s.authors = ["jarjuk"]
|
55
|
+
s.files = ["README.org", "VERSION", "#{s.name}.gemspec" ] | Dir.glob("mustache/**/*")
|
56
|
+
s.require_paths = [ "lib" ]
|
57
|
+
# s.executables = [ "tla-trace-filter.rb" ]
|
58
|
+
s.license = 'MIT'
|
59
|
+
|
60
|
+
s.required_ruby_version = '~> 2', ">=2.3"
|
61
|
+
|
62
|
+
s.add_runtime_dependency 'tla-trace-filter', '~>0.0', ">=0.0.4"
|
63
|
+
|
64
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tla-trace-arch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jarjuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-01-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tla-trace-filter
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.0'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.0.4
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.0'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.0.4
|
33
|
+
description: "\n A set of [mustache] templates extending [tla-trace-filter] -tool\n
|
34
|
+
\ to create a self extracting achieve for API traces generated, when\n model
|
35
|
+
checking formal models created by [tla-Sbuilder] -tool.\n\n Use case:\n\n Formal
|
36
|
+
models, built using [tla-sbuilder], and model checked using\n [TLA+tools]], can
|
37
|
+
generate /API Traces/, which represent\n end-to-end scenarios executing across
|
38
|
+
system services in the\n formal model. An API Trace is composed of steps, with
|
39
|
+
each step\n giving 1) a (formal) system state before the API call, 2) the API\n
|
40
|
+
\ call exercised together with (formal model) value bindings of\n request parameters,
|
41
|
+
3) API response returned, and 4) the (formal)\n system state after the API call.
|
42
|
+
\ A API Trace can be mapped to\n /Unit Tests/ on implementation with each Unit
|
43
|
+
Test corresponding a\n step in the API Trace. After executing each of the individual
|
44
|
+
Unit\n Tests, the aggregate result can be interpreted as an execution of\n a
|
45
|
+
\"virtual\" System Test - considerably easier than managing the\n execution a
|
46
|
+
System Test as a single unit.\n\n The purpose of =tla-trace-arch= GEM is create
|
47
|
+
a self extracting\n archive, which can be safely distributed to system service\n
|
48
|
+
\ developers for extracting API Trace Steps to create unit tests for\n the
|
49
|
+
service being developed by the developer.\n \n\n Ref: \n - https://github.com/jarjuk/tla-trace-filter\n
|
50
|
+
\ - https://mustache.github.io/mustache.5.html\n - https://github.com/jarjuk/tla-sbuilder\n
|
51
|
+
\ - http://research.microsoft.com/en-us/um/people/lamport/tla/tools.html\n"
|
52
|
+
email:
|
53
|
+
executables: []
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files: []
|
56
|
+
files:
|
57
|
+
- README.org
|
58
|
+
- VERSION
|
59
|
+
- mustache/api-call-after-state-post.mustache
|
60
|
+
- mustache/api-call-after-state-pre.mustache
|
61
|
+
- mustache/api-call-before-state-post.mustache
|
62
|
+
- mustache/api-call-before-state-pre.mustache
|
63
|
+
- mustache/api-call-call-post.mustache
|
64
|
+
- mustache/api-call-call-pre.mustache
|
65
|
+
- mustache/api-call-header.mustache
|
66
|
+
- mustache/api-call-init.mustache
|
67
|
+
- mustache/api-call-link.mustache
|
68
|
+
- mustache/api-call-post.mustache
|
69
|
+
- mustache/api-call-pre.mustache
|
70
|
+
- mustache/api-call-ret-post.mustache
|
71
|
+
- mustache/api-call-ret-pre.mustache
|
72
|
+
- mustache/api-call-step-post.mustache
|
73
|
+
- mustache/api-call-step-pre.mustache
|
74
|
+
- mustache/arch-call-script.mustache
|
75
|
+
- mustache/arch-demo-afterState.mustache
|
76
|
+
- mustache/arch-demo-api_input.mustache
|
77
|
+
- mustache/arch-demo-api_return.mustache
|
78
|
+
- mustache/arch-demo-beforeState.mustache
|
79
|
+
- tla-trace-arch.gemspec
|
80
|
+
homepage:
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2'
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '2.3'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.6.14
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Mustache templates to create self extracing archieve for Sbuilder API-trace
|
107
|
+
test_files: []
|