mirror of
https://github.com/pocketpy/pocketpy
synced 2025-12-06 10:10:17 +00:00
update cov
This commit is contained in:
parent
ab513822b3
commit
10c53e0621
18
run_tests.sh
18
run_tests.sh
@ -16,18 +16,18 @@ fi
|
||||
rm -rf .coverage
|
||||
mkdir .coverage
|
||||
|
||||
# remove .gcno files if the 1st line contains "Source:src/debugger/"
|
||||
find . -type f -name "*.gcno" | while read -r file; do
|
||||
first_line=$(head -n 1 "$file")
|
||||
if [[ "$first_line" == *"Source:src/debugger/"* ]]; then
|
||||
echo "Deleting: $file"
|
||||
rm -f "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
UNITS=$(find ./ -name "*.gcno")
|
||||
llvm-cov-17 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
|
||||
|
||||
mv *.gcov .coverage
|
||||
rm *.gcda
|
||||
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,5 +1,7 @@
|
||||
import re
|
||||
|
||||
whitelist = {'K', 'equal', 'V', 'less', 'NAME'}
|
||||
|
||||
def check_define_undef_pairs(code):
|
||||
# 使用正则表达式匹配#define和#undef指令
|
||||
define_pattern = re.compile(r'#define\s+(\w+)')
|
||||
@ -9,6 +11,9 @@ def check_define_undef_pairs(code):
|
||||
defines = define_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)
|
||||
undef_set = set(undefs)
|
||||
@ -21,11 +26,13 @@ def check_define_undef_pairs(code):
|
||||
print("mismatched #define")
|
||||
for define in unmatched_defines:
|
||||
print(f"- {define}")
|
||||
exit(1)
|
||||
|
||||
if unmatched_undefs:
|
||||
print("mismatched #undef")
|
||||
for undef in unmatched_undefs:
|
||||
print(f"- {undef}")
|
||||
exit(1)
|
||||
|
||||
|
||||
# iterate over all the files in `path` directory
|
||||
|
||||
@ -220,4 +220,10 @@ void c11_thrdpool__join(c11_thrdpool *pool) {
|
||||
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
|
||||
@ -28,7 +28,8 @@
|
||||
|
||||
#define DECLARE_HANDLE_FN(name) void c11_dap_handle_##name(py_Ref arguments, c11_sbuf*);
|
||||
DAP_COMMAND_LIST(DECLARE_HANDLE_FN)
|
||||
#undef DECLARE_ARG_FN
|
||||
#undef DECLARE_HANDLE_FN
|
||||
|
||||
|
||||
typedef void (*c11_dap_arg_parser_fn)(py_Ref, c11_sbuf*);
|
||||
|
||||
@ -43,6 +44,7 @@ static dap_command_entry dap_command_table[] = {
|
||||
};
|
||||
|
||||
#undef DAP_ENTRY
|
||||
#undef DAP_COMMAND_LIST
|
||||
|
||||
static struct c11_dap_server {
|
||||
int dap_next_seq;
|
||||
@ -129,12 +131,11 @@ void c11_dap_handle_setBreakpoints(py_Ref arguments, c11_sbuf* buffer) {
|
||||
PK_FREE((void*)sourcename);
|
||||
}
|
||||
|
||||
inline static void c11_dap_build_ExceptionInfo(const char* exc_type, const char* exc_message, c11_sbuf* buffer) {
|
||||
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_message = exc_message ? exc_message : "No additional details available";
|
||||
|
||||
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__ctor(&combined_buffer);
|
||||
|
||||
@ -1445,7 +1445,6 @@ bool pk_format_object(VM* self, py_Ref val, c11_sv spec) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#undef CHECK_RETURN_FROM_EXCEPT_OR_FINALLY
|
||||
#undef DISPATCH
|
||||
#undef DISPATCH_JUMP
|
||||
#undef DISPATCH_JUMP_ABSOLUTE
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <conio.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#elif PY_SYS_PLATFORM == 3 || PY_SYS_PLATFORM == 5
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user