Skip to content

Commit d67abae

Browse files
author
roman
committed
ln2 test UPDATE add fail log print
1 parent deaac67 commit d67abae

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

tests/ln2_test.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ ln2_glob_test_setup(struct ln2_test_ctx **test_ctx)
100100

101101
*test_ctx = calloc(1, sizeof **test_ctx);
102102
if (!*test_ctx) {
103+
SETUP_FAIL_LOG;
103104
ret = 1;
104105
goto cleanup;
105106
}
@@ -110,34 +111,40 @@ ln2_glob_test_setup(struct ln2_test_ctx **test_ctx)
110111
/* initialize server */
111112
ret = nc_server_init();
112113
if (ret) {
114+
SETUP_FAIL_LOG;
113115
goto cleanup;
114116
}
115117

116118
/* initialize client */
117119
ret = nc_client_init();
118120
if (ret) {
121+
SETUP_FAIL_LOG;
119122
goto cleanup;
120123
}
121124

122125
/* init barrier */
123126
ret = pthread_barrier_init(&(*test_ctx)->barrier, NULL, 2);
124127
if (ret) {
128+
SETUP_FAIL_LOG;
125129
goto cleanup;
126130
}
127131

128132
/* create libyang context */
129133
ret = ly_ctx_new(MODULES_DIR, 0, &(*test_ctx)->ctx);
130134
if (ret) {
135+
SETUP_FAIL_LOG;
131136
goto cleanup;
132137
}
133138

134139
/* load default yang modules */
135140
ret = nc_server_init_ctx(&(*test_ctx)->ctx);
136141
if (ret) {
142+
SETUP_FAIL_LOG;
137143
goto cleanup;
138144
}
139145
ret = nc_server_config_load_modules(&(*test_ctx)->ctx);
140146
if (ret) {
147+
SETUP_FAIL_LOG;
141148
goto cleanup;
142149
}
143150

tests/ln2_test.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
#define NC_ACCEPT_TIMEOUT 2000
2525
#define NC_PS_POLL_TIMEOUT 2000
2626

27+
#define SETUP_FAIL_LOG \
28+
fprintf(stderr, "Setup fail in %s:%d.\n", __FILE__, __LINE__)
29+
2730
/**
2831
* @brief Test context used for sharing data between the test and the server/client threads.
2932
*/

0 commit comments

Comments
 (0)