Hi! I'd like to know how to create src/test/data/script_tests.json JSON file? Thanks.
How to create src/test/data/script_tests.json JSON file? #11636
issue ghost opened this issue on November 8, 2017-
ghost commented at 10:55 AM on November 8, 2017: none
- fanquake added the label Tests on Nov 8, 2017
-
sipsorcery commented at 11:05 AM on November 8, 2017: member
The JSON file already exists, there's nothing you need to do to create it.
Do you mean how to create the header file from the JSON file? The src/Makefile.test.include has the commands.
%.json.h: %.json @$(MKDIR_P) $(@D) @{
echo "namespace json_tests{" &&
echo "static unsigned const char $(*F)[] = {" &&
$(HEXDUMP) -v -e '8/1 "0x%02x, "' -e '"\n"' $< | $(SED) -e 's/0x ,//g' &&
echo "};};";
} > "$@.new" && mv -f "$@.new" "$@" @echo "Generated $@"Or to make it suitable for a standalone command line (you'll need to add the echos to the top and bottom if desired):
hexdump script_tests.json -v -e '8/1 "0x%02x, "' -e '"\n"' | sed -e 's/0x ,//g' -
ghost commented at 11:09 AM on November 8, 2017: none
@sipsorcery Nope. I am making my own bitcoin and I'd like to switch the existing file. I've founded this code and is there an way to activate this?
bitcoin/src/test/script_tests.cpp:
// Uncomment if you want to output updated JSON tests. // #define UPDATE_JSON_TESTS
-
sipsorcery commented at 11:36 AM on November 8, 2017: member
In that case you just do exactly as it says. Uncomment the define and then rebuild the bitcoin source. Once the build is complete run test_bitcoin and you should end up with a script_test.json.gen.
Attached is the file I got from master.
- fanquake closed this on Nov 8, 2017
- MarcoFalke locked this on Sep 8, 2021