Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 525c51e

Browse files
committed
fix(test): Allow driver_core_cli_init take NULL
To integrate driver_core into CI, and using concise CI scripts, we should allow function `driver_core_cli_init()` to take a NULL argument. Once a NULL argument of `driver_test_cases_t` is provided, even though testing command `T` and `H` are assigned, no tags and hashes will be set.
1 parent dc67b3c commit 525c51e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/api/common.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ status_t driver_core_cli_init(ta_core_t* const core, int argc, char** argv, driv
3636
exit(EXIT_SUCCESS);
3737
case 'H':
3838
// Take the arguments as testing transaction hashes
39-
for (int i = 0; i < TXN_HASH_NUM; i++) {
40-
if (!test_cases->txn_hash[i]) {
41-
test_cases->txn_hash[i] = optarg;
39+
if (test_cases) {
40+
for (int i = 0; i < TXN_HASH_NUM; i++) {
41+
if (!test_cases->txn_hash[i]) {
42+
test_cases->txn_hash[i] = optarg;
43+
}
4244
}
4345
}
4446
break;
4547
case 'T':
4648
// Take the arguments as testing transaction tag
47-
test_cases->tag = optarg;
49+
if (test_cases) {
50+
test_cases->tag = optarg;
51+
}
4852
break;
4953
default:
5054
ret = cli_core_set(core, key, optarg);

0 commit comments

Comments
 (0)