todorb 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +12 -0
- data/Makefile +29 -0
- data/README.markdown +48 -3
- data/Rakefile +54 -0
- data/VERSION +1 -1
- data/bin/todorb +1 -1
- data/lib/common/cmdapp.rb +170 -0
- data/lib/common/sed.rb +84 -44
- data/lib/todorb.rb +508 -266
- data/tests/Makefile +2 -0
- data/tests/README +313 -0
- data/tests/aggregate-results.sh +34 -0
- data/tests/clean.sh +3 -0
- data/tests/dataset1.txt +14 -0
- data/tests/recreate.sh +33 -0
- data/tests/rtest2.sh +124 -0
- data/tests/t0001-add.sh +22 -0
- data/tests/t0002-listing.sh +58 -0
- data/tests/test-lib.sh +614 -0
- data/todorb.gemspec +62 -0
- metadata +22 -6
data/tests/Makefile
ADDED
data/tests/README
ADDED
@@ -0,0 +1,313 @@
|
|
1
|
+
todorb.rb tests
|
2
|
+
===============
|
3
|
+
|
4
|
+
This directory holds test scripts for todorb.rb . The
|
5
|
+
first part of this short document describes how to run the tests
|
6
|
+
and read their output.
|
7
|
+
|
8
|
+
When fixing the tools or adding enhancements, you are strongly
|
9
|
+
encouraged to add tests in this directory to cover what you are
|
10
|
+
trying to fix or enhance. The later part of this short document
|
11
|
+
describes how your test scripts should be organized.
|
12
|
+
|
13
|
+
|
14
|
+
Running Tests
|
15
|
+
-------------
|
16
|
+
|
17
|
+
The easiest way to run tests is to say "make test" from the top-level.
|
18
|
+
This runs all the tests.
|
19
|
+
|
20
|
+
rm -rf tests/test-results "tests/trash directory"*
|
21
|
+
cd tests && sh t0000-config.sh
|
22
|
+
* ok 1: no config file
|
23
|
+
* ok 2: config file (default location 1)
|
24
|
+
* ok 3: config file (default location 2)
|
25
|
+
* ok 4: config file (command line)
|
26
|
+
* ok 5: config file (env variable)
|
27
|
+
* passed all 5 test(s)
|
28
|
+
cd tests && sh t0001-null.sh
|
29
|
+
* ok 1: null ls
|
30
|
+
* passed all 1 test(s)
|
31
|
+
rm -rf tests/test-results
|
32
|
+
|
33
|
+
Or you can run each test individually from command line, like
|
34
|
+
this:
|
35
|
+
|
36
|
+
$ ./t0001-null.sh
|
37
|
+
* ok 1: null ls
|
38
|
+
* passed all 1 test(s)
|
39
|
+
|
40
|
+
You can pass --verbose (or -v), --debug (or -d), and --immediate
|
41
|
+
(or -i) command line argument to the test, or by setting GIT_TEST_OPTS
|
42
|
+
appropriately before running "make".
|
43
|
+
|
44
|
+
--verbose::
|
45
|
+
This makes the test more verbose. Specifically, the
|
46
|
+
command being run and their output if any are also
|
47
|
+
output.
|
48
|
+
|
49
|
+
--debug::
|
50
|
+
This may help the person who is developing a new test.
|
51
|
+
It causes the command defined with test_debug to run.
|
52
|
+
|
53
|
+
--immediate::
|
54
|
+
This causes the test to immediately exit upon the first
|
55
|
+
failed test.
|
56
|
+
|
57
|
+
--long-tests::
|
58
|
+
This causes additional long-running tests to be run (where
|
59
|
+
available), for more exhaustive testing.
|
60
|
+
|
61
|
+
--tee::
|
62
|
+
In addition to printing the test output to the terminal,
|
63
|
+
write it to files named 't/test-results/$TEST_NAME.out'.
|
64
|
+
As the names depend on the tests' file names, it is safe to
|
65
|
+
run the tests with this option in parallel.
|
66
|
+
|
67
|
+
Skipping Tests
|
68
|
+
--------------
|
69
|
+
|
70
|
+
In some environments, certain tests have no way of succeeding
|
71
|
+
due to platform limitation, such as lack of 'unzip' program, or
|
72
|
+
filesystem that do not allow arbitrary sequence of non-NUL bytes
|
73
|
+
as pathnames.
|
74
|
+
|
75
|
+
You should be able to say something like
|
76
|
+
|
77
|
+
$ SKIP_TESTS=t0000.2 sh ./t0000-config.sh
|
78
|
+
|
79
|
+
and even:
|
80
|
+
|
81
|
+
$ SKIP_TESTS='t[0-4]??? t91?? t9200.8' make
|
82
|
+
|
83
|
+
to omit such tests. The value of the environment variable is a
|
84
|
+
SP separated list of patterns that tells which tests to skip,
|
85
|
+
and either can match the "t[0-9]{4}" part to skip the whole
|
86
|
+
test, or t[0-9]{4} followed by ".$number" to say which
|
87
|
+
particular test to skip.
|
88
|
+
|
89
|
+
Note that some tests in the existing test suite rely on previous
|
90
|
+
test item, so you cannot arbitrarily disable one and expect the
|
91
|
+
remainder of test to check what the test originally was intended
|
92
|
+
to check.
|
93
|
+
|
94
|
+
|
95
|
+
Naming Tests
|
96
|
+
------------
|
97
|
+
|
98
|
+
The test files are named as:
|
99
|
+
|
100
|
+
tNNNN-commandname-details.sh
|
101
|
+
|
102
|
+
where N is a decimal digit.
|
103
|
+
|
104
|
+
First digit tells the family:
|
105
|
+
|
106
|
+
0 - the absolute basics and global stuff
|
107
|
+
1 - basic every-day usage
|
108
|
+
2 - add ins
|
109
|
+
|
110
|
+
Second digit tells the particular command we are testing.
|
111
|
+
|
112
|
+
Third digit (optionally) tells the particular switch or group of switches
|
113
|
+
we are testing.
|
114
|
+
|
115
|
+
If you create files under tests/ directory (i.e. here) that is not
|
116
|
+
the top-level test script, never name the file to match the above
|
117
|
+
pattern. The Makefile here considers all such files as the
|
118
|
+
top-level test script and tries to run all of them. A care is
|
119
|
+
especially needed if you are creating a common test library
|
120
|
+
file, similar to test-lib.sh, because such a library file may
|
121
|
+
not be suitable for standalone execution.
|
122
|
+
|
123
|
+
|
124
|
+
Writing Tests
|
125
|
+
-------------
|
126
|
+
|
127
|
+
The test script is written as a shell script. It should start
|
128
|
+
with the standard "#!/bin/sh" with copyright notices, and an
|
129
|
+
assignment to variable 'test_description', like this:
|
130
|
+
|
131
|
+
#!/bin/sh
|
132
|
+
#
|
133
|
+
# Copyright (c) 2005 Junio C Hamano
|
134
|
+
#
|
135
|
+
|
136
|
+
test_description='xxx test (option --frotz)
|
137
|
+
|
138
|
+
This test registers the following structure in the cache
|
139
|
+
and tries to run git-ls-files with option --frotz.'
|
140
|
+
|
141
|
+
|
142
|
+
Source 'test-lib.sh'
|
143
|
+
--------------------
|
144
|
+
|
145
|
+
After assigning test_description, the test script should source
|
146
|
+
test-lib.sh like this:
|
147
|
+
|
148
|
+
. ./test-lib.sh
|
149
|
+
|
150
|
+
This test harness library does the following things:
|
151
|
+
|
152
|
+
- If the script is invoked with command line argument --help
|
153
|
+
(or -h), it shows the test_description and exits.
|
154
|
+
|
155
|
+
- Creates an empty test directory with an empty todo file
|
156
|
+
database and chdir(2) into it. This directory is 't/trash directory'
|
157
|
+
if you must know, but I do not think you care.
|
158
|
+
|
159
|
+
- Defines standard test helper functions for your scripts to
|
160
|
+
use. These functions are designed to make all scripts behave
|
161
|
+
consistently when command line arguments --verbose (or -v),
|
162
|
+
--debug (or -d), and --immediate (or -i) is given.
|
163
|
+
|
164
|
+
|
165
|
+
End with test_done
|
166
|
+
------------------
|
167
|
+
|
168
|
+
Your script will be a sequence of tests, using helper functions
|
169
|
+
from the test harness library. At the end of the script, call
|
170
|
+
'test_done'.
|
171
|
+
|
172
|
+
|
173
|
+
Test harness library
|
174
|
+
--------------------
|
175
|
+
|
176
|
+
There are a handful helper functions defined in the test harness
|
177
|
+
library for your script to use.
|
178
|
+
|
179
|
+
- test_todo_session <message> < transcript
|
180
|
+
|
181
|
+
This takes a single string as a parameter, which is treated
|
182
|
+
as a base description of what is being tested, and then
|
183
|
+
reads from standard input a transcript of todorb.rb commands
|
184
|
+
and expected output. Each command is run in the current
|
185
|
+
test environment and the output is compared with the
|
186
|
+
expected output. (See below for how to generate transcripts
|
187
|
+
easily.)
|
188
|
+
|
189
|
+
- test_tick [interval]
|
190
|
+
|
191
|
+
The test harness has an internal view of time which is
|
192
|
+
implemented by wrapping the date command. This takes a single
|
193
|
+
optional positive integer parameter which indicates how much
|
194
|
+
to advance the internal time. The default value is one day.
|
195
|
+
|
196
|
+
- test_expect_success <message> <script>
|
197
|
+
|
198
|
+
This takes two strings as parameter, and evaluates the
|
199
|
+
<script>. If it yields success, test is considered
|
200
|
+
successful. <message> should state what it is testing.
|
201
|
+
|
202
|
+
Example:
|
203
|
+
|
204
|
+
test_expect_success \
|
205
|
+
'git-write-tree should be able to write an empty tree.' \
|
206
|
+
'tree=$(git-write-tree)'
|
207
|
+
|
208
|
+
- test_expect_failure <message> <script>
|
209
|
+
|
210
|
+
This is NOT the opposite of test_expect_success, but is used
|
211
|
+
to mark a test that demonstrates a known breakage. Unlike
|
212
|
+
the usual test_expect_success tests, which say "ok" on
|
213
|
+
success and "FAIL" on failure, this will say "FIXED" on
|
214
|
+
success and "still broken" on failure. Failures from these
|
215
|
+
tests won't cause -i (immediate) to stop.
|
216
|
+
|
217
|
+
- test_debug <script>
|
218
|
+
|
219
|
+
This takes a single argument, <script>, and evaluates it only
|
220
|
+
when the test script is started with --debug command line
|
221
|
+
argument. This is primarily meant for use during the
|
222
|
+
development of a new test script.
|
223
|
+
|
224
|
+
- test_done
|
225
|
+
|
226
|
+
Your test script must have test_done at the end. Its purpose
|
227
|
+
is to summarize successes and failures in the test script and
|
228
|
+
exit with an appropriate error code.
|
229
|
+
|
230
|
+
|
231
|
+
Generating test transcripts
|
232
|
+
---------------------------
|
233
|
+
|
234
|
+
You can generate test scripts from screenshots as following:
|
235
|
+
|
236
|
+
$ ./testshell.sh
|
237
|
+
|
238
|
+
You'll be in a special test environment with an empty TODO2.txt
|
239
|
+
and the dates and timestamps will be artificially fixed.
|
240
|
+
|
241
|
+
Then the session can be used to make a unit test thanks to
|
242
|
+
test_todo_session, see the existing tests as examples.
|
243
|
+
|
244
|
+
Be careful to replace all occurences of the full path to the test
|
245
|
+
directory by $HOME as testshell.sh will explain you when you execute it
|
246
|
+
otherwise the tests will work properly only on your own computer.
|
247
|
+
|
248
|
+
Don't use "script" as this would log every keystroke, not only what's
|
249
|
+
visible!!
|
250
|
+
|
251
|
+
***NOTE***
|
252
|
+
|
253
|
+
I am not clear how to generate transcripts using the above.
|
254
|
+
The script rtest2.sh actually generates a fully working test case/suite.
|
255
|
+
You may interactively enter actions and the action and result will get
|
256
|
+
written into a test script.
|
257
|
+
-- rkumar 2009-12-21 23:43
|
258
|
+
|
259
|
+
Credits
|
260
|
+
-------
|
261
|
+
|
262
|
+
This test framework was derived from the framework used by
|
263
|
+
git itself, written originally by Junio Hamano and licensed
|
264
|
+
for use under the GPL. It was specialized for todo.txt-cli
|
265
|
+
by Emil Sit and Philippe Teuwen.
|
266
|
+
Further modified for todorb.rb by Rahul Kumar.
|
267
|
+
|
268
|
+
./rtest2.sh --load dataset1.txt "listing"
|
269
|
+
then type commands in there.
|
270
|
+
NOTE that a blank line in output terminates what "expect" file gets so test will fail.
|
271
|
+
|
272
|
+
|
273
|
+
Issues and Drawbacks with this framework
|
274
|
+
----------------------------------------
|
275
|
+
|
276
|
+
This framework uses the standard output of a command as the expected
|
277
|
+
result. This usually means the message reported to the user on success or
|
278
|
+
failure. If we change the message, the test breaks. Similarly, any
|
279
|
+
change to the formatting of a listing breaks *many* tests.
|
280
|
+
|
281
|
+
The actual result in the file is not being checked, only the informational
|
282
|
+
message. To circumvent the problem of recreating test cases whenever output
|
283
|
+
changes, one may pipe the commands from a broken test file to rtest2.sh and create
|
284
|
+
a fresh file.
|
285
|
+
grep '^>>> ' t0001-broken.sh \
|
286
|
+
| sed 's/^>>> *//' \
|
287
|
+
| ./rtest2.sh --load data1.txt "listing"
|
288
|
+
|
289
|
+
Note that any data created on top of the broken test file, is to be saved and passed
|
290
|
+
in the --load parameter to rtest2.sh.
|
291
|
+
|
292
|
+
Date related:
|
293
|
+
-------------
|
294
|
+
This script works fine with shell scripts that use "date" to derive
|
295
|
+
date. There's a nice hack in the bin directorythat is created at runtime
|
296
|
+
in the trash folder. However, my ruby prog does not use "date". It uses
|
297
|
+
Time.now(). So the add method which appends a date appends actual date
|
298
|
+
not the fake date 12345000.
|
299
|
+
|
300
|
+
Fix for ruby programs:
|
301
|
+
t = Time.now
|
302
|
+
ut = ENV["TODO_TEST_TIME"]
|
303
|
+
t = Time.at(ut.to_i) if ut
|
304
|
+
|
305
|
+
Add the line of picking up unix time stamp from env and using that, if it's there.
|
306
|
+
|
307
|
+
Testing for failure returned by method
|
308
|
+
=== 1
|
309
|
+
=== -1
|
310
|
+
prior to output
|
311
|
+
PLEASE be sure to unset any TODO_ env variables prior to test, such as
|
312
|
+
TODO_SHOW_ALL or else tests will fail when its not set!
|
313
|
+
## vim:tw=72:ai:formatoptions=tcqln:nocindent
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
fixed=0
|
4
|
+
success=0
|
5
|
+
failed=0
|
6
|
+
broken=0
|
7
|
+
total=0
|
8
|
+
|
9
|
+
for file
|
10
|
+
do
|
11
|
+
while read type value
|
12
|
+
do
|
13
|
+
case $type in
|
14
|
+
'')
|
15
|
+
continue ;;
|
16
|
+
fixed)
|
17
|
+
fixed=$(($fixed + $value)) ;;
|
18
|
+
success)
|
19
|
+
success=$(($success + $value)) ;;
|
20
|
+
failed)
|
21
|
+
failed=$(($failed + $value)) ;;
|
22
|
+
broken)
|
23
|
+
broken=$(($broken + $value)) ;;
|
24
|
+
total)
|
25
|
+
total=$(($total + $value)) ;;
|
26
|
+
esac
|
27
|
+
done <"$file"
|
28
|
+
done
|
29
|
+
|
30
|
+
printf "%-8s%d\n" fixed $fixed
|
31
|
+
printf "%-8s%d\n" success $success
|
32
|
+
printf "%-8s%d\n" failed $failed
|
33
|
+
printf "%-8s%d\n" broken $broken
|
34
|
+
printf "%-8s%d\n" total $total
|
data/tests/clean.sh
ADDED
data/tests/dataset1.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
1 [x] if no TODO file give proper message to add task (2010-06-14)
|
2
|
+
2 [x] what if no serial_number file? (2010-06-14)
|
3
|
+
3 [x] Add a close for status close (2010-06-14)
|
4
|
+
3.1 [ ] hello there new a u 3 (2010-06-15)
|
5
|
+
3.1.1 [ ] hello there new a u 3 (2010-06-15)
|
6
|
+
3.1.2 [ ] hello there new a u 3 (2010-06-15)
|
7
|
+
3.1.3 [ ] hello there new a u 3 (2010-06-15)
|
8
|
+
3.2 [ ] hello there new a u 3.2 (2010-06-15)
|
9
|
+
3.2.1 [ ] hello there new a u 3.2.1 (2010-06-15)
|
10
|
+
3.2.1.1 [ ] hello there new a u 3.2.1.1 (2010-06-15)
|
11
|
+
4 [ ] start rubyforge project for todorb (2010-06-14)
|
12
|
+
5 [ ] list: if dir given then show full path of TODO2.txt at end (2010-06-14)
|
13
|
+
6 [ ] allow for ENV VARS such as verbose, plain, force (2010-06-15)
|
14
|
+
7 [ ] list: search terms with - + and = (2010-06-15)
|
data/tests/recreate.sh
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#*******************************************************#
|
3
|
+
# recreate.sh
|
4
|
+
# written by Rahul Kumar #
|
5
|
+
# 2009/12/01 #
|
6
|
+
# recreate a failed test - pass the name of the earlier#
|
7
|
+
# test program. In some cases, you may have to rename #
|
8
|
+
# transcript.txt to the testcase since cp -i failes #
|
9
|
+
#*******************************************************#
|
10
|
+
|
11
|
+
# oldfile is the old test cases such as t0001-add.sh
|
12
|
+
oldfile="$1"
|
13
|
+
[ ! -f "$oldfile" ] && { echo "Could not find $oldfile"; exit -1 ; }
|
14
|
+
|
15
|
+
LOADSTR=
|
16
|
+
if grep -q CATEOF "$oldfile"; then
|
17
|
+
sed -n '/<<CATEOF/,/^CATEOF/p' "$oldfile" | grep -v "CATEOF" > data.1
|
18
|
+
LOADSTR='--load data.1'
|
19
|
+
echo found data, saved as data.1
|
20
|
+
wc -l data.1
|
21
|
+
fi
|
22
|
+
str=$( echo "$oldfile" | sed 's/^t[0-9]*-//;s/.sh$//' )
|
23
|
+
echo "Using suffix:$str"
|
24
|
+
read -p "press enter "
|
25
|
+
grep '^>>> ' "$oldfile" | sed 's/^>>> //'
|
26
|
+
read -p "press enter "
|
27
|
+
grep '^>>> ' "$oldfile" | sed 's/^>>> //' | ./rtest2.sh $LOADSTR "$str"
|
28
|
+
|
29
|
+
echo
|
30
|
+
echo renaming old file with O prefix
|
31
|
+
mv "$oldfile" O$oldfile
|
32
|
+
echo "If you don't find a test case, then rename transcript.txt to $oldfile"
|
33
|
+
echo "cp transcript.txt $oldfile"
|
data/tests/rtest2.sh
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#*******************************************************#
|
3
|
+
# gentest.sh #
|
4
|
+
# written by Rahul Kumar #
|
5
|
+
# December 21, 2009 #
|
6
|
+
# #
|
7
|
+
# generates a test case #
|
8
|
+
#*******************************************************#
|
9
|
+
# @param - test descriptor - short name
|
10
|
+
#+ will be used in test_desc and filename suffix
|
11
|
+
#
|
12
|
+
# If testing for error, and command returns 1
|
13
|
+
#+ place "=== 1" on first line or result
|
14
|
+
|
15
|
+
while [[ $1 = -* ]]; do
|
16
|
+
case "$1" in
|
17
|
+
-L|--load)
|
18
|
+
# load a file containing TODO2.txt data to test against
|
19
|
+
dataset=../$2
|
20
|
+
shift
|
21
|
+
shift
|
22
|
+
;;
|
23
|
+
*)
|
24
|
+
echo "Error: Unknown option: $1" >&2 # rem _
|
25
|
+
exit 1
|
26
|
+
;;
|
27
|
+
esac
|
28
|
+
done
|
29
|
+
|
30
|
+
if [[ -z "$1" ]]; then
|
31
|
+
echo -n "Test Description (short, no spaces): " 1>&2
|
32
|
+
read td
|
33
|
+
else
|
34
|
+
td="$1"
|
35
|
+
fi
|
36
|
+
# for generating a serial number
|
37
|
+
APP="todorb-test"
|
38
|
+
|
39
|
+
PS1=">>>"
|
40
|
+
out="$(pwd)/transcript.txt"
|
41
|
+
test_description="Testing of $td"
|
42
|
+
filesuffix=$( echo "$td" | sed 's/ /_/g' )
|
43
|
+
|
44
|
+
|
45
|
+
. ./test-lib.sh
|
46
|
+
trap - EXIT
|
47
|
+
if [[ ! -z "$dataset" ]]; then
|
48
|
+
if [[ ! -f "$dataset" ]]; then
|
49
|
+
echo "Can't find file $dataset"
|
50
|
+
exit 1
|
51
|
+
else
|
52
|
+
wc -l "$dataset"
|
53
|
+
fi
|
54
|
+
fi
|
55
|
+
if [[ ! -z "$dataset" ]]; then
|
56
|
+
cp "${dataset}" TODO2.txt
|
57
|
+
pre+=$( echo -e "cat > TODO2.txt <<CATEOF")
|
58
|
+
pre+="\n"
|
59
|
+
pre+=$(cat TODO2.txt)
|
60
|
+
pre+=$( echo -e "\nCATEOF\n" )
|
61
|
+
fi
|
62
|
+
str=""
|
63
|
+
> "$out"
|
64
|
+
|
65
|
+
history -r .rtest2.history
|
66
|
+
## get user input, stop when user enters 'bye'
|
67
|
+
while read -ep ">>> " line
|
68
|
+
do
|
69
|
+
# echo -n ">>> "
|
70
|
+
# read line
|
71
|
+
[ -z "$line" ] && { echo "bye to quit"; continue; }
|
72
|
+
[[ "$line" = "bye" ]] && break;
|
73
|
+
[ -n "$line" ] && history -s "$line"
|
74
|
+
|
75
|
+
## user can execute test_tick in current shell
|
76
|
+
[[ "$line" = *test_tick* ]] && {
|
77
|
+
times=$( expr "$line" : 'test_tick \(.*\)' )
|
78
|
+
# should be multiples of 86400 or at least more than 86400
|
79
|
+
test_tick $times;
|
80
|
+
}
|
81
|
+
|
82
|
+
if grep -q "^list" <<< "$line"; then
|
83
|
+
line=$( echo "$line" | sed 's/^list/t --sort-serial list/')
|
84
|
+
fi
|
85
|
+
if grep -q "^ls" <<< "$line"; then
|
86
|
+
line=$( echo "$line" | sed 's/^ls/t --sort-serial --no-colors list/')
|
87
|
+
fi
|
88
|
+
line=$(echo "$line" | sed 's/--ss /--sort-serial /')
|
89
|
+
line=$(echo "$line" | sed 's/--nc /--no-colors /')
|
90
|
+
#[[ "$line" = "list" ]] && line="t --sort-serial list";
|
91
|
+
#[[ "$line" = "ls" ]] && line="t --sort-serial --no-colors list";
|
92
|
+
line=$(echo "$line" | sed 's/^t /todorb /')
|
93
|
+
echo ">>> $line" >> $out
|
94
|
+
eval "$line" | tee -a "$out"
|
95
|
+
echo "" >> $out
|
96
|
+
done
|
97
|
+
|
98
|
+
## generate the test case transcript
|
99
|
+
str="$( cat $out )"
|
100
|
+
> "$out"
|
101
|
+
cat > "$out" <<EOF
|
102
|
+
#!/bin/sh
|
103
|
+
test_description="Testing out $td "
|
104
|
+
. ./test-lib.sh
|
105
|
+
|
106
|
+
|
107
|
+
EOF
|
108
|
+
echo -e "$pre" >> "$out"
|
109
|
+
echo "" >> "$out"
|
110
|
+
echo "test_todo_session \"Testing of $td\" <<EOF" >> "$out"
|
111
|
+
echo "$str" >> "$out"
|
112
|
+
echo "" >> "$out"
|
113
|
+
echo "EOF" >> "$out"
|
114
|
+
echo "test_done" >> "$out"
|
115
|
+
|
116
|
+
# try to create a decent file name
|
117
|
+
serno=$( get_serial_number -a "$APP" -d "../" )
|
118
|
+
serno=$( printf "%04s" "$serno" )
|
119
|
+
filename="../t${serno}-${filesuffix}.sh"
|
120
|
+
echo "trying to copy $out to $filename"
|
121
|
+
chmod +x "$out"
|
122
|
+
cp -i "$out" "$filename" < /dev/tty
|
123
|
+
chmod +x "$filename"
|
124
|
+
echo "Please rename $filename to prevent possible overwriting"
|