-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfd_tests.h
95 lines (79 loc) · 2.77 KB
/
fd_tests.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef HEADER_src_ballet_runtime_tests_fd_tests_h
#define HEADER_src_ballet_runtime_tests_fd_tests_h
#include "../../flamenco/runtime/fd_runtime.h"
#include <regex.h>
#include "../../flamenco/features/fd_features.h"
/* Framework for running Solana's native program tests in our runtime */
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
#define fd_feature_offset(x) offsetof( fd_features_t, x )
struct fd_executor_test_acc {
fd_pubkey_t pubkey;
ulong lamports;
ulong result_lamports;
ulong data_len;
ulong result_data_len;
const uchar* data;
const uchar* result_data;
uchar executable;
uchar result_executable;
ulong rent_epoch;
ulong result_rent_epoch;
fd_pubkey_t owner;
fd_pubkey_t result_owner;
};
typedef struct fd_executor_test_acc fd_executor_test_acc_t;
#define FD_EXECUTOR_TEST_ACC_FOOTPRINT ( sizeof(fd_executor_test_acc_t) )
struct fd_test_sysvar_cache {
char * clock;
char * epoch_schedule;
char * epoch_rewards;
char * fees;
char * rent;
char * slot_hashes;
char * recent_block_hashes;
char * stake_history;
char * slot_history;
};
typedef struct fd_test_sysvar_cache fd_test_sysvar_cache_t;
#define FD_TEST_SYSVAR_CACHE_FOOTPRINT ( sizeof(fd_test_sysvar_cache_t) )
struct fd_executor_test {
char* test_name;
int test_number;
uint disable_cnt;
uchar *disable_feature;
const char *bt;
fd_pubkey_t program_id;
fd_executor_test_acc_t* accs;
ulong accs_len;
const uchar* raw_tx;
ulong raw_tx_len;
int expected_result;
uint custom_err;
ulong nonce;
fd_test_sysvar_cache_t sysvar_cache;
};
typedef struct fd_executor_test fd_executor_test_t;
#define FD_EXECUTOR_TEST_FOOTPRINT ( sizeof(fd_executor_test_t) )
struct fd_executor_test_suite {
fd_wksp_t * wksp;
fd_funk_t * funk;
fd_blockstore_t * blockstore;
fd_valloc_t valloc;
regex_t filter_ex;
const char * filter;
fd_features_t features;
char ignore_fail[5000];
};
typedef struct fd_executor_test_suite fd_executor_test_suite_t;
#define FD_EXECUTOR_TEST_SUITE_FOOTPRINT ( sizeof(fd_executor_test_suite_t) )
typedef int (* fd_executor_test_fn)( fd_executor_test_suite_t * );
FD_PROTOTYPES_BEGIN
void fd_executor_test_suite_new( fd_executor_test_suite_t* suite );
int fd_executor_run_test(
fd_executor_test_t* test,
fd_executor_test_suite_t* suite) ;
/* Tests defined by test program. Null terminated */
extern fd_executor_test_fn tests[];
extern ulong test_cnt;
FD_PROTOTYPES_END
#endif /* HEADER_src_ballet_runtime_tests_fd_tests_h */