FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update some tests from 3.13.7 by ShaharNaveh · Pull Request #6108 · RustPython/RustPython · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .d  (4) .expected  (5) .py  (18) .rs  (2) .stp  (3) .txt  (4) No extension  (1) dotfile  (1) All 8 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
5 changes: 5 additions & 0 deletions .gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ flamescope.json

extra_tests/snippets/resources
extra_tests/not_impl.py

Lib/site-packages/*
!Lib/site-packages/README.txt
Lib/test/data/*
!Lib/test/data/README
2 changes: 2 additions & 0 deletions Lib/test/data/README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This empty directory serves as destination for temporary files
created by some tests, in particular, the test_codecmaps_* tests.
5 changes: 5 additions & 0 deletions Lib/test/dtracedata/assert_usable.d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BEGIN
{
printf("probe: success\n");
exit(0);
}
5 changes: 5 additions & 0 deletions Lib/test/dtracedata/assert_usable.stp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
probe begin
{
println("probe: success")
exit ()
}
31 changes: 31 additions & 0 deletions Lib/test/dtracedata/call_stack.d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
self int indent;

python$target:::function-entry
/copyinstr(arg1) == "start"/
{
self->trace = 1;
}

python$target:::function-entry
/self->trace/
{
printf("%d\t%*s:", timestamp, 15, probename);
printf("%*s", self->indent, "");
printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
self->indent++;
}

python$target:::function-return
/self->trace/
{
self->indent--;
printf("%d\t%*s:", timestamp, 15, probename);
printf("%*s", self->indent, "");
printf("%s:%s:%d\n", basename(copyinstr(arg0)), copyinstr(arg1), arg2);
}

python$target:::function-return
/copyinstr(arg1) == "start"/
{
self->trace = 0;
}
18 changes: 18 additions & 0 deletions Lib/test/dtracedata/call_stack.d.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function-entry:call_stack.py:start:23
function-entry: call_stack.py:function_1:1
function-entry: call_stack.py:function_3:9
function-return: call_stack.py:function_3:10
function-return: call_stack.py:function_1:2
function-entry: call_stack.py:function_2:5
function-entry: call_stack.py:function_1:1
function-entry: call_stack.py:function_3:9
function-return: call_stack.py:function_3:10
function-return: call_stack.py:function_1:2
function-return: call_stack.py:function_2:6
function-entry: call_stack.py:function_3:9
function-return: call_stack.py:function_3:10
function-entry: call_stack.py:function_4:13
function-return: call_stack.py:function_4:14
function-entry: call_stack.py:function_5:18
function-return: call_stack.py:function_5:21
function-return:call_stack.py:start:28
30 changes: 30 additions & 0 deletions Lib/test/dtracedata/call_stack.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
def function_1():
function_3(1, 2)

# Check stacktrace
def function_2():
function_1()

# CALL_FUNCTION_VAR
def function_3(dummy, dummy2):
pass

# CALL_FUNCTION_KW
def function_4(**dummy):
return 1
return 2 # unreachable

# CALL_FUNCTION_VAR_KW
def function_5(dummy, dummy2, **dummy3):
if False:
return 7
return 8

def start():
function_1()
function_2()
function_3(1, 2)
function_4(test=42)
function_5(*(1, 2), **{"test": 42})

start()
41 changes: 41 additions & 0 deletions Lib/test/dtracedata/call_stack.stp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
global tracing

function basename:string(path:string)
{
last_token = token = tokenize(path, "/");
while (token != "") {
last_token = token;
token = tokenize("", "/");
}
return last_token;
}

probe process.mark("function__entry")
{
funcname = user_string($arg2);

if (funcname == "start") {
tracing = 1;
}
}

probe process.mark("function__entry"), process.mark("function__return")
{
filename = user_string($arg1);
funcname = user_string($arg2);
lineno = $arg3;

if (tracing) {
printf("%d\t%s:%s:%s:%d\n", gettimeofday_us(), $$name,
basename(filename), funcname, lineno);
}
}

probe process.mark("function__return")
{
funcname = user_string($arg2);

if (funcname == "start") {
tracing = 0;
}
}
14 changes: 14 additions & 0 deletions Lib/test/dtracedata/call_stack.stp.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function__entry:call_stack.py:start:23
function__entry:call_stack.py:function_1:1
function__return:call_stack.py:function_1:2
function__entry:call_stack.py:function_2:5
function__entry:call_stack.py:function_1:1
function__return:call_stack.py:function_1:2
function__return:call_stack.py:function_2:6
function__entry:call_stack.py:function_3:9
function__return:call_stack.py:function_3:10
function__entry:call_stack.py:function_4:13
function__return:call_stack.py:function_4:14
function__entry:call_stack.py:function_5:18
function__return:call_stack.py:function_5:21
function__return:call_stack.py:start:28
18 changes: 18 additions & 0 deletions Lib/test/dtracedata/gc.d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
python$target:::function-entry
/copyinstr(arg1) == "start"/
{
self->trace = 1;
}

python$target:::gc-start,
python$target:::gc-done
/self->trace/
{
printf("%d\t%s:%ld\n", timestamp, probename, arg0);
}

python$target:::function-return
/copyinstr(arg1) == "start"/
{
self->trace = 0;
}
8 changes: 8 additions & 0 deletions Lib/test/dtracedata/gc.d.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
gc-start:0
gc-done:0
gc-start:1
gc-done:0
gc-start:2
gc-done:0
gc-start:2
gc-done:1
13 changes: 13 additions & 0 deletions Lib/test/dtracedata/gc.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import gc

def start():
gc.collect(0)
gc.collect(1)
gc.collect(2)
l = []
l.append(l)
del l
gc.collect(2)

gc.collect()
start()
26 changes: 26 additions & 0 deletions Lib/test/dtracedata/gc.stp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
global tracing

probe process.mark("function__entry")
{
funcname = user_string($arg2);

if (funcname == "start") {
tracing = 1;
}
}

probe process.mark("gc__start"), process.mark("gc__done")
{
if (tracing) {
printf("%d\t%s:%ld\n", gettimeofday_us(), $$name, $arg1);
}
}

probe process.mark("function__return")
{
funcname = user_string($arg2);

if (funcname == "start") {
tracing = 0;
}
}
8 changes: 8 additions & 0 deletions Lib/test/dtracedata/gc.stp.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
gc__start:0
gc__done:0
gc__start:1
gc__done:0
gc__start:2
gc__done:0
gc__start:2
gc__done:1
24 changes: 24 additions & 0 deletions Lib/test/dtracedata/instance.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import gc

class old_style_class():
pass
class new_style_class(object):
pass

a = old_style_class()
del a
gc.collect()
b = new_style_class()
del b
gc.collect()

a = old_style_class()
del old_style_class
gc.collect()
b = new_style_class()
del new_style_class
gc.collect()
del a
gc.collect()
del b
gc.collect()
7 changes: 7 additions & 0 deletions Lib/test/dtracedata/line.d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python$target:::line
/(copyinstr(arg1)=="test_line")/
{
printf("%d\t%s:%s:%s:%d\n", timestamp,
probename, basename(copyinstr(arg0)),
copyinstr(arg1), arg2);
}
20 changes: 20 additions & 0 deletions Lib/test/dtracedata/line.d.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
line:line.py:test_line:2
line:line.py:test_line:3
line:line.py:test_line:4
line:line.py:test_line:5
line:line.py:test_line:6
line:line.py:test_line:7
line:line.py:test_line:8
line:line.py:test_line:9
line:line.py:test_line:10
line:line.py:test_line:11
line:line.py:test_line:4
line:line.py:test_line:5
line:line.py:test_line:6
line:line.py:test_line:7
line:line.py:test_line:8
line:line.py:test_line:10
line:line.py:test_line:11
line:line.py:test_line:4
line:line.py:test_line:12
line:line.py:test_line:13
17 changes: 17 additions & 0 deletions Lib/test/dtracedata/line.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def test_line():
a = 1
print('# Preamble', a)
for i in range(2):
a = i
b = i+2
c = i+3
if c < 4:
a = c
d = a + b +c
print('#', a, b, c, d)
a = 1
print('# Epilogue', a)


if __name__ == '__main__':
test_line()
Loading
Loading

Back | FazBrowse Home | New Git URL