Add c++ unit tests with docs; split out ./rpctest and ./cpptest from ./test

This commit is contained in:
Duke
2026-03-03 17:30:56 -05:00
parent 7e1b5701a6
commit 4a69d23e05
9 changed files with 135 additions and 70 deletions

47
test
View File

@@ -1,47 +1,8 @@
#!/usr/bin/env perl
# Copyright 2016-2026 The Hush developers
#!/bin/bash
# Copyright 2026-now The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
use strict;
use warnings;
use 5.010;
# Run c++ tests first, they are faster
./cpptest && ./rpctest
my $flags = $ENV{TEST_FLAGS} || '--tracerpc';
my $test_dir = './qa/rpc-tests';
$ENV{PYTHONPATH} = "./qa/rpc-tests/test_framework/";
#$ENV{PYTHON_DEBUG} = 1;
my @tests_to_run = qw{
lockzins.py
shieldcoinbase_donation.py
};
my $exit = 0;
my $failed_tests = 0;
my $time=time();
my $num_tests = @tests_to_run;
print "# Running $num_tests tests";
for my $test (@tests_to_run) {
# send both stderr+stdout to our output file
my $cmd = "$test_dir/$test $flags 1>test-$time.txt 2>&1";
system($cmd);
print ".";
if($?) {
say "$cmd FAILED!";
$exit = 1;
$failed_tests++;
}
}
print "\n";
if ($exit) {
say "FAIL! Number of failed tests: $failed_tests . Details in test-$time.txt";
} else {
say "PASS!";
}
exit($exit);