Skip to content

Commit dae9584

Browse files
authored
Update some tests from 3.13.7 (#6108)
* Update `test_opcache.py` * Update test_optparse.py * Add some missing folders & test files * Update `test_long.py` and impl "is_integer" for int * Update `support/hypothesis_helper.py` from 3.13.7 * Update test_binascii * Update test_math * Add `test_math_property.py` * Update `test_property.py` from 3.13.7 * Update `test_cmath.py` from 3.13.7 * Unmark passing tests * Update `test_ucn.py` from 3.13.7 * Mark failing tests * Add `site-packages` dir
2 parents 5c6f92d + e7c8796 commit dae9584

38 files changed

+2771
-194
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@ flamescope.json
2121

2222
extra_tests/snippets/resources
2323
extra_tests/not_impl.py
24+
25+
Lib/site-packages/*
26+
!Lib/site-packages/README.txt
27+
Lib/test/data/*
28+
!Lib/test/data/README

Lib/test/data/README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This empty directory serves as destination for temporary files
2+
created by some tests, in particular, the test_codecmaps_* tests.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BEGIN
2+
{
3+
printf("probe: success\n");
4+
exit(0);
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
probe begin
2+
{
3+
println("probe: success")
4+
exit ()
5+
}

Lib/test/dtracedata/call_stack.d

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
self int indent;
2+
3+
python$target:::function-entry
4+
/copyinstr(arg1) == "start"/
5+
{
6+
self->trace = 1;
7+
}
8+
9+
python$target:::function-entry
10+
/self->trace/
11+
{
12+
printf("%d\t%*s:", timestamp, 15, probename);
13+
printf("%*s", self->indent, "");
14+
printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
15+
self->indent++;
16+
}
17+
18+
python$target:::function-return
19+
/self->trace/
20+
{
21+
self->indent--;
22+
printf("%d\t%*s:", timestamp, 15, probename);
23+
printf("%*s", self->indent, "");
24+
printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
25+
}
26+
27+
python$target:::function-return
28+
/copyinstr(arg1) == "start"/
29+
{
30+
self->trace = 0;
31+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function-entry:call_stack.py:start:23
2+
function-entry: call_stack.py:function_1:1
3+
function-entry: call_stack.py:function_3:9
4+
function-return: call_stack.py:function_3:10
5+
function-return: call_stack.py:function_1:2
6+
function-entry: call_stack.py:function_2:5
7+
function-entry: call_stack.py:function_1:1
8+
function-entry: call_stack.py:function_3:9
9+
function-return: call_stack.py:function_3:10
10+
function-return: call_stack.py:function_1:2
11+
function-return: call_stack.py:function_2:6
12+
function-entry: call_stack.py:function_3:9
13+
function-return: call_stack.py:function_3:10
14+
function-entry: call_stack.py:function_4:13
15+
function-return: call_stack.py:function_4:14
16+
function-entry: call_stack.py:function_5:18
17+
function-return: call_stack.py:function_5:21
18+
function-return:call_stack.py:start:28

Lib/test/dtracedata/call_stack.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
def function_1():
2+
function_3(1, 2)
3+
4+
# Check stacktrace
5+
def function_2():
6+
function_1()
7+
8+
# CALL_FUNCTION_VAR
9+
def function_3(dummy, dummy2):
10+
pass
11+
12+
# CALL_FUNCTION_KW
13+
def function_4(**dummy):
14+
return 1
15+
return 2 # unreachable
16+
17+
# CALL_FUNCTION_VAR_KW
18+
def function_5(dummy, dummy2, **dummy3):
19+
if False:
20+
return 7
21+
return 8
22+
23+
def start():
24+
function_1()
25+
function_2()
26+
function_3(1, 2)
27+
function_4(test=42)
28+
function_5(*(1, 2), **{"test": 42})
29+
30+
start()

Lib/test/dtracedata/call_stack.stp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
global tracing
2+
3+
function basename:string(path:string)
4+
{
5+
last_token = token = tokenize(path, "/");
6+
while (token != "") {
7+
last_token = token;
8+
token = tokenize("", "/");
9+
}
10+
return last_token;
11+
}
12+
13+
probe process.mark("function__entry")
14+
{
15+
funcname = user_string($arg2);
16+
17+
if (funcname == "start") {
18+
tracing = 1;
19+
}
20+
}
21+
22+
probe process.mark("function__entry"), process.mark("function__return")
23+
{
24+
filename = user_string($arg1);
25+
funcname = user_string($arg2);
26+
lineno = $arg3;
27+
28+
if (tracing) {
29+
printf("%d\t%s:%s:%s:%d\n", gettimeofday_us(), $$name,
30+
basename(filename), funcname, lineno);
31+
}
32+
}
33+
34+
probe process.mark("function__return")
35+
{
36+
funcname = user_string($arg2);
37+
38+
if (funcname == "start") {
39+
tracing = 0;
40+
}
41+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function__entry:call_stack.py:start:23
2+
function__entry:call_stack.py:function_1:1
3+
function__return:call_stack.py:function_1:2
4+
function__entry:call_stack.py:function_2:5
5+
function__entry:call_stack.py:function_1:1
6+
function__return:call_stack.py:function_1:2
7+
function__return:call_stack.py:function_2:6
8+
function__entry:call_stack.py:function_3:9
9+
function__return:call_stack.py:function_3:10
10+
function__entry:call_stack.py:function_4:13
11+
function__return:call_stack.py:function_4:14
12+
function__entry:call_stack.py:function_5:18
13+
function__return:call_stack.py:function_5:21
14+
function__return:call_stack.py:start:28

Lib/test/dtracedata/gc.d

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
python$target:::function-entry
2+
/copyinstr(arg1) == "start"/
3+
{
4+
self->trace = 1;
5+
}
6+
7+
python$target:::gc-start,
8+
python$target:::gc-done
9+
/self->trace/
10+
{
11+
printf("%d\t%s:%ld\n", timestamp, probename, arg0);
12+
}
13+
14+
python$target:::function-return
15+
/copyinstr(arg1) == "start"/
16+
{
17+
self->trace = 0;
18+
}

0 commit comments

Comments
 (0)