Skip to content

Commit c88d935

Browse files
committed
Fix remaining code coverage issues, hopefully
1 parent f0e28be commit c88d935

File tree

8 files changed

+33
-4
lines changed

8 files changed

+33
-4
lines changed

.github/workflows/cron-ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
args: --verbose
3434
env:
3535
CARGO_INCREMENTAL: '0'
36-
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests' # -Cpanic=abort
36+
RUSTC_WRAPPER: './scripts/codecoverage-rustc-wrapper.sh'
3737
- uses: actions/setup-python@v1
3838
with:
3939
python-version: 3.8
@@ -48,9 +48,10 @@ jobs:
4848
run: pipenv run pytest -v
4949
working-directory: ./extra_tests
5050
env:
51+
RUSTPYTHON_TESTS_NOBUILD: 'true'
5152
RUSTPYTHON_DEBUG: 'true'
5253
- name: run cpython tests
53-
run: cargo run -- -m test -v
54+
run: target/debug/rustpython -m test -v
5455
env:
5556
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
5657
- uses: actions-rs/grcov@v0.1

Lib/test/test_fileio.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ def testReprNoCloseFD(self):
176176
finally:
177177
os.close(fd)
178178

179+
@unittest.skipIf(getattr(sys, '_rustpython_debugbuild', False), "stack overflow on debug build")
179180
def testRecursiveRepr(self):
180181
# Issue #25455
181182
with swap_attr(self.f, 'name', self.f):

Lib/test/test_ftplib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import sys
2626
if sys.platform == 'win32':
2727
raise unittest.SkipTest("test_ftplib not working on windows")
28+
if getattr(sys, '_rustpython_debugbuild', False):
29+
raise unittest.SkipTest("something's weird on debug builds")
2830

2931
TIMEOUT = 3
3032
# the dummy data returned by server over the data channel when

Lib/test/test_sys.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ def test_recursionlimit(self):
226226
self.assertEqual(sys.getrecursionlimit(), 10000)
227227
sys.setrecursionlimit(oldlimit)
228228

229+
@unittest.skipIf(getattr(sys, "_rustpython_debugbuild", False), "stack overflow on debug build")
229230
def test_recursionlimit_recovery(self):
230231
if hasattr(sys, 'gettrace') and sys.gettrace():
231232
self.skipTest('fatal error if run with a trace function')

extra_tests/custom_text_test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def addSkip(self, test, reason):
370370
self.stream.writeln("SKIPPED {0!r}".format(reason))
371371
self.stream.flush()
372372
self.results['suites'][self.suite_map[self.suite]]['cases'][self.current_case_number]['result'] = 'skipped'
373-
self.results['suites'][self.suite_map[self.suite]]['cases'][self.current_case_number]['note'] = getattr(getattr(test, test._testMethodName), "__unittest_skip_why__", reason)
373+
self.results['suites'][self.suite_map[self.suite]]['cases'][self.current_case_number]['note'] = reason
374374
self.num_skipped += 1
375375

376376
def addExpectedFailure(self, test, err):
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash -e
2+
3+
get_crate_name() {
4+
while [[ $# -gt 1 ]]; do
5+
case "$1" in
6+
--crate-name)
7+
echo "$2"
8+
return
9+
;;
10+
esac
11+
shift
12+
done
13+
}
14+
15+
case $(get_crate_name "$@") in
16+
rustpython_*|rustpython)
17+
EXTRA=(-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests) # -Cpanic=abort
18+
;;
19+
20+
*) EXTRA=() ;;
21+
esac
22+
23+
exec "$@" "${EXTRA[@]}"

vm/src/stdlib/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ mod _os {
12741274
Ok(())
12751275
}
12761276

1277-
#[cfg(unix)]
1277+
#[cfg(all(unix, not(any(target_os = "redox", target_os = "android"))))]
12781278
#[pyfunction]
12791279
fn getloadavg(vm: &VirtualMachine) -> PyResult<(f64, f64, f64)> {
12801280
let mut loadavg = [0f64; 3];

vm/src/sysmodule.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ settrace() -- set the global debug tracing function
708708
"float_repr_style" => ctx.new_str("short"),
709709
"_xoptions" => xopts,
710710
"warnoptions" => warnopts,
711+
"_rustpython_debugbuild" => ctx.new_bool(cfg!(debug_assertions)),
711712
});
712713

713714
#[cfg(windows)]

0 commit comments

Comments
 (0)