mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-06 18:20:17 +00:00
Compare commits
No commits in common. "10c53e0621c95ba9aa255bbf4258ef6b0686ffbf" and "ef9b4779f44cd63d05a471c0b7bea4feb14e4db0" have entirely different histories.
10c53e0621
...
ef9b4779f4
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@ -64,10 +64,6 @@ jobs:
|
|||||||
bash build_g.sh
|
bash build_g.sh
|
||||||
bash run_tests.sh
|
bash run_tests.sh
|
||||||
rm -rf ./main
|
rm -rf ./main
|
||||||
- name: Run Script Check
|
|
||||||
run: |
|
|
||||||
python scripts/check_pragma_once.py include
|
|
||||||
python scripts/check_undef.py src
|
|
||||||
- name: Unit Test with Coverage
|
- name: Unit Test with Coverage
|
||||||
run: bash run_tests.sh
|
run: bash run_tests.sh
|
||||||
- name: Upload coverage reports to Codecov
|
- name: Upload coverage reports to Codecov
|
||||||
|
|||||||
13
run_tests.sh
13
run_tests.sh
@ -4,7 +4,7 @@ python prebuild.py
|
|||||||
|
|
||||||
SRC=$(find src/ -name "*.c")
|
SRC=$(find src/ -name "*.c")
|
||||||
|
|
||||||
clang -std=c11 --coverage -O1 -Wfatal-errors -o main src2/main.c $SRC -Iinclude -DPK_ENABLE_OS=1 -lm -ldl -DNDEBUG
|
clang -std=c11 --coverage -O1 -Wfatal-errors -o main src2/main.c $SRC -Iinclude -DPK_ENABLE_OS=1 -DPK_ENABLE_PROFILER=1 -lm -ldl -DNDEBUG
|
||||||
|
|
||||||
python scripts/run_tests.py
|
python scripts/run_tests.py
|
||||||
|
|
||||||
@ -17,17 +17,8 @@ rm -rf .coverage
|
|||||||
mkdir .coverage
|
mkdir .coverage
|
||||||
|
|
||||||
UNITS=$(find ./ -name "*.gcno")
|
UNITS=$(find ./ -name "*.gcno")
|
||||||
llvm-cov-17 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
|
llvm-cov-15 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
|
||||||
|
|
||||||
mv *.gcov .coverage
|
mv *.gcov .coverage
|
||||||
rm *.gcda
|
rm *.gcda
|
||||||
rm *.gcno
|
rm *.gcno
|
||||||
|
|
||||||
# remove .gcno files if the 1st line contains "Source:src/debugger/"
|
|
||||||
find .coverage/ -type f -name "*.gcov" | while read -r file; do
|
|
||||||
first_line=$(head -n 1 "$file")
|
|
||||||
if [[ "$first_line" == *"Source:src/debugger/"* ]]; then
|
|
||||||
echo "Removing: $file"
|
|
||||||
rm "$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
whitelist = {'K', 'equal', 'V', 'less', 'NAME'}
|
|
||||||
|
|
||||||
def check_define_undef_pairs(code):
|
def check_define_undef_pairs(code):
|
||||||
# 使用正则表达式匹配#define和#undef指令
|
# 使用正则表达式匹配#define和#undef指令
|
||||||
define_pattern = re.compile(r'#define\s+(\w+)')
|
define_pattern = re.compile(r'#define\s+(\w+)')
|
||||||
@ -11,9 +9,6 @@ def check_define_undef_pairs(code):
|
|||||||
defines = define_pattern.findall(code)
|
defines = define_pattern.findall(code)
|
||||||
undefs = undef_pattern.findall(code)
|
undefs = undef_pattern.findall(code)
|
||||||
|
|
||||||
defines = [x for x in defines if x not in whitelist]
|
|
||||||
undefs = [x for x in undefs if x not in whitelist]
|
|
||||||
|
|
||||||
# 使用集合计算差集,找出不匹配的部分
|
# 使用集合计算差集,找出不匹配的部分
|
||||||
define_set = set(defines)
|
define_set = set(defines)
|
||||||
undef_set = set(undefs)
|
undef_set = set(undefs)
|
||||||
@ -26,13 +21,11 @@ def check_define_undef_pairs(code):
|
|||||||
print("mismatched #define")
|
print("mismatched #define")
|
||||||
for define in unmatched_defines:
|
for define in unmatched_defines:
|
||||||
print(f"- {define}")
|
print(f"- {define}")
|
||||||
exit(1)
|
|
||||||
|
|
||||||
if unmatched_undefs:
|
if unmatched_undefs:
|
||||||
print("mismatched #undef")
|
print("mismatched #undef")
|
||||||
for undef in unmatched_undefs:
|
for undef in unmatched_undefs:
|
||||||
print(f"- {undef}")
|
print(f"- {undef}")
|
||||||
exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
# iterate over all the files in `path` directory
|
# iterate over all the files in `path` directory
|
||||||
|
|||||||
@ -220,10 +220,4 @@ void c11_thrdpool__join(c11_thrdpool *pool) {
|
|||||||
c11_thrdpool_debug_log(-1, "All %d tasks completed, `sync_val` was reset.", num_tasks);
|
c11_thrdpool_debug_log(-1, "All %d tasks completed, `sync_val` was reset.", num_tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef C11_THRDPOOL_DEBUG
|
|
||||||
|
|
||||||
#ifdef c11_thrdpool_debug_log
|
|
||||||
#undef c11_thrdpool_debug_log
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // PK_ENABLE_THREADS
|
#endif // PK_ENABLE_THREADS
|
||||||
@ -28,8 +28,7 @@
|
|||||||
|
|
||||||
#define DECLARE_HANDLE_FN(name) void c11_dap_handle_##name(py_Ref arguments, c11_sbuf*);
|
#define DECLARE_HANDLE_FN(name) void c11_dap_handle_##name(py_Ref arguments, c11_sbuf*);
|
||||||
DAP_COMMAND_LIST(DECLARE_HANDLE_FN)
|
DAP_COMMAND_LIST(DECLARE_HANDLE_FN)
|
||||||
#undef DECLARE_HANDLE_FN
|
#undef DECLARE_ARG_FN
|
||||||
|
|
||||||
|
|
||||||
typedef void (*c11_dap_arg_parser_fn)(py_Ref, c11_sbuf*);
|
typedef void (*c11_dap_arg_parser_fn)(py_Ref, c11_sbuf*);
|
||||||
|
|
||||||
@ -44,7 +43,6 @@ static dap_command_entry dap_command_table[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#undef DAP_ENTRY
|
#undef DAP_ENTRY
|
||||||
#undef DAP_COMMAND_LIST
|
|
||||||
|
|
||||||
static struct c11_dap_server {
|
static struct c11_dap_server {
|
||||||
int dap_next_seq;
|
int dap_next_seq;
|
||||||
@ -131,11 +129,12 @@ void c11_dap_handle_setBreakpoints(py_Ref arguments, c11_sbuf* buffer) {
|
|||||||
PK_FREE((void*)sourcename);
|
PK_FREE((void*)sourcename);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void c11_dap_build_ExceptionInfo(const char* exc_type, const char* exc_message, c11_sbuf* buffer) {
|
inline static void c11_dap_build_ExceptionInfo(const char* exc_type, const char* exc_message, c11_sbuf* buffer) {
|
||||||
const char* safe_type = exc_type ? exc_type : "UnknownException";
|
const char* safe_type = exc_type ? exc_type : "UnknownException";
|
||||||
const char* safe_message = exc_message ? exc_message : "No additional details available";
|
const char* safe_message = exc_message ? exc_message : "No additional details available";
|
||||||
|
|
||||||
c11_sv type_sv = {.data = safe_type, .size = strlen(safe_type)};
|
c11_sv type_sv = {.data = safe_type, .size = strlen(safe_type)};
|
||||||
|
c11_sv message_sv = {.data = safe_message, .size = strlen(safe_message)};
|
||||||
|
|
||||||
c11_sbuf combined_buffer;
|
c11_sbuf combined_buffer;
|
||||||
c11_sbuf__ctor(&combined_buffer);
|
c11_sbuf__ctor(&combined_buffer);
|
||||||
|
|||||||
@ -1445,6 +1445,7 @@ bool pk_format_object(VM* self, py_Ref val, c11_sv spec) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef CHECK_RETURN_FROM_EXCEPT_OR_FINALLY
|
||||||
#undef DISPATCH
|
#undef DISPATCH
|
||||||
#undef DISPATCH_JUMP
|
#undef DISPATCH_JUMP
|
||||||
#undef DISPATCH_JUMP_ABSOLUTE
|
#undef DISPATCH_JUMP_ABSOLUTE
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
|
||||||
|
|
||||||
#elif PY_SYS_PLATFORM == 3 || PY_SYS_PLATFORM == 5
|
#elif PY_SYS_PLATFORM == 3 || PY_SYS_PLATFORM == 5
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user