fix socket_GET test case

This commit is contained in:
Lyon 2023-07-23 19:01:35 +08:00
parent e4eb341a10
commit d7087248c6
7 changed files with 39 additions and 13 deletions

View File

@ -174,7 +174,8 @@ char* _socket__gethostbyname(PikaObj *self, char* host){
__platform_printf("gethostbyname error\n"); __platform_printf("gethostbyname error\n");
return NULL; return NULL;
} }
ip = pika_platform_inet_ntoa(*((struct in_addr *)host_entry->h_addr_list[0])); ip =
pika_platform_inet_ntoa(*((struct in_addr*)host_entry->h_addr_list[0]));
return obj_cacheStr(self, ip); return obj_cacheStr(self, ip);
} }

View File

@ -16,6 +16,10 @@ sh std_push.sh PikaStdData
sh std_push.sh PikaDebug sh std_push.sh PikaDebug
sh std_push.sh PikaStdTask sh std_push.sh PikaStdTask
sh std_push.sh builtins sh std_push.sh builtins
sh version.sh
python3 format.py
echo "$FLAG_OK Push \033[32mpikascript-core\033[0m to ../../src successfully!" echo "$FLAG_OK Push \033[32mpikascript-core\033[0m to ../../src successfully!"
echo "$FLAG_OK Push \033[32mPikaSdLib\033[0m to ../../package/PikaStdLib successfully!" echo "$FLAG_OK Push \033[32mPikaSdLib\033[0m to ../../package/PikaStdLib successfully!"
echo "$FLAG_NOTE Now, you can run 'git commit -a' to commit changes." echo "$FLAG_NOTE Now, you can run 'git commit -a' to commit changes."

View File

@ -291,8 +291,14 @@ TEST(socket, json_issue) {
} }
#endif #endif
TEST_RUN_SINGLE_FILE_PASS(socket, socket_GET, "test/python/socket/socket_GET.py") TEST_RUN_SINGLE_FILE_ASSERT(socket,
TEST_RUN_SINGLE_FILE_PASS(socket, socket_DNS, "test/python/socket/socket_DNS.py") socket_GET,
"test/python/socket/socket_GET.py",
obj_getBool(pikaMain, "res") == pika_true)
TEST_RUN_SINGLE_FILE_PASS(socket,
socket_DNS,
"test/python/socket/socket_DNS.py")
#endif #endif

View File

@ -27,5 +27,4 @@ while True:
s.close() s.close()
assert 'HTTP/1.1 200 OK' in response res = 'HTTP/1.1 200 OK' in response
print('PASS')

View File

@ -59,6 +59,23 @@ extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
EXPECT_EQ(pikaMemNow(), 0); \ EXPECT_EQ(pikaMemNow(), 0); \
} }
#define TEST_RUN_SINGLE_FILE_ASSERT(_test_suite_, _test_name_, _file_name_, \
__expt__) \
TEST(_test_suite_, _test_name_) { \
g_PikaMemInfo.heapUsedMax = 0; \
PikaObj* pikaMain = newRootObj("pikaMain", New_PikaMain); \
extern unsigned char pikaModules_py_a[]; \
obj_linkLibrary(pikaMain, pikaModules_py_a); \
/* run */ \
__platform_printf("BEGIN\r\n"); \
pikaVM_runSingleFile(pikaMain, _file_name_); \
/* assert */ \
EXPECT_TRUE((__expt__)); \
/* deinit */ \
obj_deinit(pikaMain); \
EXPECT_EQ(pikaMemNow(), 0); \
}
#define TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(_test_suite_, _test_name_, \ #define TEST_RUN_SINGLE_FILE_EXCEPT_OUTPUT(_test_suite_, _test_name_, \
_file_name_, _except_output_) \ _file_name_, _except_output_) \
TEST(_test_suite_, _test_name_) { \ TEST(_test_suite_, _test_name_) { \

View File

@ -1,3 +1,2 @@
python3 version.py python3 version.py
mv PikaVersion.h package/pikascript/pikascript-core/ mv PikaVersion.h package/pikascript/pikascript-core/
sh push-core.sh

View File

@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 12 #define PIKA_VERSION_MINOR 12
#define PIKA_VERSION_MICRO 4 #define PIKA_VERSION_MICRO 4
#define PIKA_EDIT_TIME "2023/07/20 13:04:16" #define PIKA_EDIT_TIME "2023/07/23 19:00:47"