mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
fix socket_GET test case
This commit is contained in:
parent
e4eb341a10
commit
d7087248c6
@ -165,16 +165,17 @@ char* _socket__gethostname(PikaObj* self) {
|
||||
return obj_cacheStr(self, hostname);
|
||||
}
|
||||
|
||||
char* _socket__gethostbyname(PikaObj *self, char* host){
|
||||
struct hostent *host_entry;
|
||||
char *ip = NULL;
|
||||
char* _socket__gethostbyname(PikaObj* self, char* host) {
|
||||
struct hostent* host_entry;
|
||||
char* ip = NULL;
|
||||
host_entry = pika_platform_gethostbyname(host);
|
||||
if (host_entry == NULL) {
|
||||
obj_setErrorCode(self, PIKA_RES_ERR_RUNTIME_ERROR);
|
||||
__platform_printf("gethostbyname error\n");
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,10 @@ sh std_push.sh PikaStdData
|
||||
sh std_push.sh PikaDebug
|
||||
sh std_push.sh PikaStdTask
|
||||
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[32mPikaSdLib\033[0m to ../../package/PikaStdLib successfully!"
|
||||
echo "$FLAG_NOTE Now, you can run 'git commit -a' to commit changes."
|
||||
|
@ -291,8 +291,14 @@ TEST(socket, json_issue) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_RUN_SINGLE_FILE_PASS(socket, socket_GET, "test/python/socket/socket_GET.py")
|
||||
TEST_RUN_SINGLE_FILE_PASS(socket, socket_DNS, "test/python/socket/socket_DNS.py")
|
||||
TEST_RUN_SINGLE_FILE_ASSERT(socket,
|
||||
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
|
||||
|
||||
|
@ -27,5 +27,4 @@ while True:
|
||||
|
||||
s.close()
|
||||
|
||||
assert 'HTTP/1.1 200 OK' in response
|
||||
print('PASS')
|
||||
res = 'HTTP/1.1 200 OK' in response
|
||||
|
@ -59,6 +59,23 @@ extern char log_buff[LOG_BUFF_MAX][LOG_SIZE];
|
||||
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_, \
|
||||
_file_name_, _except_output_) \
|
||||
TEST(_test_suite_, _test_name_) { \
|
||||
|
@ -1,3 +1,2 @@
|
||||
python3 version.py
|
||||
mv PikaVersion.h package/pikascript/pikascript-core/
|
||||
sh push-core.sh
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define PIKA_VERSION_MAJOR 1
|
||||
#define PIKA_VERSION_MINOR 12
|
||||
#define PIKA_VERSION_MICRO 4
|
||||
#define PIKA_VERSION_MAJOR 1
|
||||
#define PIKA_VERSION_MINOR 12
|
||||
#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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user