@ -9,15 +9,17 @@ use test::{ColorConfig, Options, OutputFormat, RunIgnored, TestDescAndFn, TestFn
@@ -9,15 +9,17 @@ use test::{ColorConfig, Options, OutputFormat, RunIgnored, TestDescAndFn, TestFn
use crate ::console ::Console ;
use crate ::gfx ::Gfx ;
use crate ::services ::hid ::{ Hid , KeyPad } ;
use crate ::services ::Apt ;
/// A custom runner to be used with `#[test_runner]`. This simple implementation
/// runs all tests in series, "failing" on the first one to panic (really, the
/// panic is just treated the same as any normal application panic).
pub ( crate ) fn test_ runner ( tests : & [ & TestDescAndFn ] ) {
pub ( crate ) fn run ( tests : & [ & TestDescAndFn ] ) {
crate ::init ( ) ;
let gfx = Gfx ::default ( ) ;
let hid = Hid ::init ( ) . unwrap ( ) ;
let apt = Apt ::init ( ) . unwrap ( ) ;
let mut top_screen = gfx . top_screen . borrow_mut ( ) ;
top_screen . set_wide_mode ( true ) ;
@ -38,18 +40,17 @@ pub(crate) fn test_runner(tests: &[&TestDescAndFn]) {
@@ -38,18 +40,17 @@ pub(crate) fn test_runner(tests: &[&TestDescAndFn]) {
exclude_should_panic : false ,
run_ignored : RunIgnored ::No ,
run_tests : true ,
// Benchmarks are not supported
// Don't run benchmarks. We may want to create a separate runner for them in the future
bench_benchmarks : false ,
logfile : None ,
nocapture : false ,
// TODO: color doesn't work because of TERM/TERMINFO.
// With RomFS we might be able to fake this out nicely...
color : ColorConfig ::Always Color ,
color : ColorConfig ::Auto Color ,
format : OutputFormat ::Pretty ,
shuffle : false ,
shuffle_seed : None ,
// tweak values? This seems to work out of the box
test_threads : Some ( 3 ) ,
test_threads : None ,
skip : Vec ::new ( ) ,
time_options : None ,
options : Options ::new ( ) ,
@ -61,19 +62,19 @@ pub(crate) fn test_runner(tests: &[&TestDescAndFn]) {
@@ -61,19 +62,19 @@ pub(crate) fn test_runner(tests: &[&TestDescAndFn]) {
// Make sure the user can actually see the results before we exit
println! ( "Press START to exit." ) ;
while apt . main_loop ( ) {
gfx . flush_buffers ( ) ;
gfx . swap_buffers ( ) ;
gfx . wait_for_vblank ( ) ;
loop {
hid . scan_input ( ) ;
if hid . keys_down ( ) . contains ( KeyPad ::KEY_START ) {
break ;
}
}
}
/// Adapted from [`test::test_main_static`], along with [` make_owned_test`].
/// Adapted from [`test::test_main_static`] and [`test:: make_owned_test`].
fn run_static_tests ( opts : & TestOpts , tests : & [ & TestDescAndFn ] ) -> io ::Result < bool > {
let tests = tests . iter ( ) . map ( make_owned_test ) . collect ( ) ;
test ::run_tests_console ( opts , tests )
@ -98,8 +99,7 @@ fn make_owned_test(test: &&TestDescAndFn) -> TestDescAndFn {
@@ -98,8 +99,7 @@ fn make_owned_test(test: &&TestDescAndFn) -> TestDescAndFn {
}
/// The following functions are stubs needed to link the test library,
/// but do nothing because we don't actually need them for it to work (hopefully).
// TODO: move to linker-fix-3ds ?
/// but do nothing because we don't actually need them for the runner to work.
mod link_fix {
#[ no_mangle ]
extern "C" fn execvp (
@ -114,15 +114,6 @@ mod link_fix {
@@ -114,15 +114,6 @@ mod link_fix {
- 1
}
#[ no_mangle ]
extern "C" fn pthread_sigmask (
_how : ::libc ::c_int ,
_set : * const libc ::sigset_t ,
_oldset : * mut libc ::sigset_t ,
) -> ::libc ::c_int {
- 1
}
#[ no_mangle ]
extern "C" fn sigemptyset ( _arg1 : * mut libc ::sigset_t ) -> ::libc ::c_int {
- 1