11# Test Suite to parse the relevant variable the sanity.t once built
22
3- use lib ' inc' ;
4- use lib ' lib' ;
3+ use lib ' /home/dispatch/testMap/c-lib/test-nginx/ inc' ;
4+ use lib ' /home/dispatch/testMap/c-lib/test-nginx/ lib' ;
55use Test ::Nginx::Socket ' no_plan' ;
66
77no_long_string();
@@ -14,7 +14,7 @@ __DATA__
1414
1515=== TEST 1 : Set C_FUNC_TEST_1
1616-- - config
17- ngx_http_c_func_link_lib " NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH /libcfuntest.so" ;
17+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t /libcfuntest.so" ;
1818location = /testCFunGreeting {
1919 ngx_http_c_func_call " my_app_simple_get_greeting" ;
2020}
@@ -28,7 +28,7 @@ qr/greeting from ngx_http_c_func testing$/
2828
2929=== TEST 2 : Set C_FUNC_TEST_ARGS
3030-- - config
31- ngx_http_c_func_link_lib " NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH /libcfuntest.so" ;
31+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t /libcfuntest.so" ;
3232location = /testCFunARGS {
3333 ngx_http_c_func_call " my_app_simple_get_args" ;
3434}
@@ -41,12 +41,9 @@ Content-Type: text/plain
4141qr/ greeting= hello_nginx\? id= 129310923 $/
4242
4343
44-
45-
46-
4744=== TEST 3 : Set C_FUNC_TEST_POST_NONE
4845-- - config
49- ngx_http_c_func_link_lib " NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH /libcfuntest.so" ;
46+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t /libcfuntest.so" ;
5047location = /testCFunPOSTBody {
5148 ngx_http_c_func_call " my_app_simple_post" ;
5249}
@@ -60,25 +57,9 @@ Content-Type: text/plain
6057qr/ \s/
6158
6259
63- === TEST 4 : Set C_FUNC_TEST_POST_BODY
60+ === TEST 4 : Set C_FUNC_TEST_GET_TOKEN
6461-- - config
65- ngx_http_c_func_link_lib " NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH/libcfuntest.so" ;
66- location = /testCFunPOSTBody {
67- ngx_http_c_func_call " my_app_simple_post" ;
68- }
69- --- request
70- POST /testCFunPOSTBody
71- greeting= enjoy-http-c-function-testing
72- -- - error_code: 202
73- -- - response_headers
74- Content-Type: text/ plain
75- -- - response_body_like eval
76- qr/ greeting= enjoy-http-c-function-testing$/
77-
78-
79- === TEST 5 : Set C_FUNC_TEST_GET_TOKEN
80- -- - config
81- ngx_http_c_func_link_lib " NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH/libcfuntest.so" ;
62+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t/libcfuntest.so" ;
8263location = /testCFunCVerifyToken {
8364 ngx_http_c_func_call " my_app_simple_get_token_args" ;
8465}
@@ -91,14 +72,60 @@ Content-Type: text/plain
9172qr/ QVNKS0pDQVNLTEpDS0xBU0pXbGtlandrbGplIGpka2FqbGthc2tsZGtqbHNrICBrZGpha2xzZGphc2Rhcw== $/
9273
9374
94- === TEST 6 : Set C_FUNC_TEST_GET_ERROR_RESP
75+ === TEST 5 : Set C_FUNC_TEST_GET_ERROR_RESP
9576-- - config
96- ngx_http_c_func_link_lib " NGINX_HTTP_C_FUNCTION_TEST_LIB_PATH /libcfuntest.so" ;
77+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t /libcfuntest.so" ;
9778location = /testCFUNCERRORRESP {
9879 ngx_http_c_func_call " my_app_simple_get_no_resp" ;
9980}
10081--- request
10182GET /testCFUNCERRORRESP? token= QVNKS0pDQVNLTEpDS0xBU0pXbGtlandrbGplIGpka2FqbGthc2tsZGtqbHNrICBrZGpha2xzZGphc2Rhcw==
10283-- - error_code: 500
10384-- - response_headers
104- Content-Type: text/ html
85+ Content-Type: text/ html
86+
87+
88+ === TEST 6 : Set C_FUNC_TEST_GET_CALLOC_FROM_POOL
89+ -- - config
90+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t/libcfuntest.so" ;
91+ location = /testCFUNCCallocFromPool {
92+ ngx_http_c_func_call " my_app_simple_get_calloc_from_pool" ;
93+ }
94+ --- request
95+ GET /testCFUNCCallocFromPool
96+ -- - error_code: 200
97+ -- - response_headers
98+ Content-Type: text/ plain
99+ -- - response_body_like eval
100+ qr/ This is the message calloc from pool$/
101+
102+
103+ === TEST 7 : Set C_FUNC_TEST_POST_BODY
104+ -- - config
105+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t/libcfuntest.so" ;
106+ location = /testCFunPOSTBody {
107+ ngx_http_c_func_call " my_app_simple_post" ;
108+ }
109+ --- request
110+ POST /testCFunPOSTBody
111+ greeting= enjoy-http-c-function-testing
112+ -- - error_code: 202
113+ -- - response_headers
114+ Content-Type: text/ plain
115+ -- - response_body_like eval
116+ qr/ greeting= enjoy-http-c-function-testing$/
117+
118+
119+ === TEST 8 : Set C_FUNC_TEST_CACHE
120+ -- - config
121+ ngx_http_c_func_link_lib " /home/dispatch/testMap/c-lib/nginx-c-function/t/libcfuntest.so" ;
122+ location = /testCFunGetCache {
123+ ngx_http_c_func_call " my_app_simple_get_cache" ;
124+ }
125+ --- request
126+ POST /testCFunGetCache
127+ -- - error_code: 200
128+ -- - response_headers
129+ Content-Type: text/ plain
130+ -- - response_body_like eval
131+ qr/ This is cache value $/
0 commit comments