Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Allred
crown-core
Commits
d7893863
Commit
d7893863
authored
10 years ago
by
Jeff Garzik
Browse files
Options
Download
Email Patches
Plain Diff
Add "it works" test for bitcoin-tx
parent
dd281970
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
.gitignore
+1
-0
.gitignore
src/Makefile.test.include
+8
-1
src/Makefile.test.include
src/test/bctest.py
+35
-0
src/test/bctest.py
src/test/bitcoin-util-test.py
+12
-0
src/test/bitcoin-util-test.py
src/test/data/bitcoin-util-test.json
+5
-0
src/test/data/bitcoin-util-test.json
src/test/data/blanktx.hex
+1
-0
src/test/data/blanktx.hex
with
62 additions
and
1 deletion
+62
-1
.gitignore
View file @
d7893863
...
...
@@ -43,6 +43,7 @@ src/qt/test/moc*.cpp
*.bak
*.rej
*.orig
*.pyc
*.o
*.o-*
*.patch
...
...
This diff is collapsed.
Click to expand it.
src/Makefile.test.include
View file @
d7893863
TESTS
+=
test
/test_bitcoin
TESTS
+=
test
/test_bitcoin
test
/bitcoin-util-test.py
bin_PROGRAMS
+=
test
/test_bitcoin
TEST_SRCDIR
=
test
TEST_BINARY
=
test
/test_bitcoin
$(EXEEXT)
EXTRA_DIST
+=
\
test
/bctest.py
\
test
/bitcoin-util-test.py
\
test
/data/bitcoin-util-test.json
\
test
/data/blanktx.hex
JSON_TEST_FILES
=
\
test
/data/script_valid.json
\
test
/data/base58_keys_valid.json
\
...
...
This diff is collapsed.
Click to expand it.
src/test/bctest.py
0 → 100644
View file @
d7893863
# Copyright 2014 BitPay, Inc.
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import
subprocess
import
os
import
json
import
sys
def
bctest
(
testDir
,
testObj
):
execargs
=
testObj
[
'exec'
]
outputFn
=
testObj
[
'output_cmp'
]
outputData
=
open
(
testDir
+
"/"
+
outputFn
).
read
()
proc
=
subprocess
.
Popen
(
execargs
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
try
:
outs
=
proc
.
communicate
()
except
OSError
:
print
(
"OSError, Failed to execute "
+
execargs
[
0
])
sys
.
exit
(
1
)
if
outs
[
0
]
!=
outputData
:
print
(
"Output data mismatch for "
+
outputFn
)
sys
.
exit
(
1
)
def
bctester
(
testDir
,
input_basename
):
input_filename
=
testDir
+
"/"
+
input_basename
raw_data
=
open
(
input_filename
).
read
()
input_data
=
json
.
loads
(
raw_data
)
for
testObj
in
input_data
:
bctest
(
testDir
,
testObj
)
sys
.
exit
(
0
)
This diff is collapsed.
Click to expand it.
src/test/bitcoin-util-test.py
0 → 100755
View file @
d7893863
#!/usr/bin/python
# Copyright 2014 BitPay, Inc.
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import
os
import
bctest
if
__name__
==
'__main__'
:
bctest
.
bctester
(
os
.
environ
[
"srcdir"
]
+
"/test/data"
,
"bitcoin-util-test.json"
)
This diff is collapsed.
Click to expand it.
src/test/data/bitcoin-util-test.json
0 → 100644
View file @
d7893863
[
{
"exec"
:
[
"./bitcoin-tx"
,
"-create"
],
"output_cmp"
:
"blanktx.hex"
}
]
This diff is collapsed.
Click to expand it.
src/test/data/blanktx.hex
0 → 100644
View file @
d7893863
01000000000000000000
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment