File tree Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Expand file tree Collapse file tree 6 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,10 @@ function run_tests_minimal {
7373 fi
7474
7575 ./miri test -- " $@ "
76+
77+ # Ensure that a small smoke test of cargo-miri works.
78+ # Note: This doesn't work on windows because of TLS.
79+ cargo miri run --manifest-path test-cargo-miri/no-std-smoke/Cargo.toml
7680}
7781
7882# host
Original file line number Diff line number Diff line change @@ -81,6 +81,10 @@ version = "0.1.0"
8181name = " issue_rust_86261"
8282version = " 0.1.0"
8383
84+ [[package ]]
85+ name = " no-std-smoke"
86+ version = " 0.1.0"
87+
8488[[package ]]
8589name = " proc-macro2"
8690version = " 1.0.44"
Original file line number Diff line number Diff line change 11[workspace ]
22members = [" subcrate" , " issue-1567" , " exported-symbol-dep" ]
3+ exclude = [" no-std-smoke" ] # it wants to be panic="abort"
34
45[package ]
56name = " cargo-miri-test"
Original file line number Diff line number Diff line change 1+ # This file is automatically @generated by Cargo.
2+ # It is not intended for manual editing.
3+ version = 3
4+
5+ [[package ]]
6+ name = " no-std-smoke"
7+ version = " 0.1.0"
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " no-std-smoke"
3+ version = " 0.1.0"
4+ edition = " 2021"
5+
6+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+ [dependencies ]
9+
10+ [profile .dev ]
11+ panic = ' abort'
12+
13+ [profile .release ]
14+ panic = ' abort'
Original file line number Diff line number Diff line change 1+ // Copied from tests/pass/no-std.rs
2+
3+ #![ feature( start) ]
4+ #![ no_std]
5+
6+ // Plumbing to let us use `writeln!` to host stdout:
7+
8+ extern "Rust" {
9+ fn miri_write_to_stdout ( bytes : & [ u8 ] ) ;
10+ }
11+
12+ struct Host ;
13+
14+ use core:: fmt:: Write ;
15+
16+ impl Write for Host {
17+ fn write_str ( & mut self , s : & str ) -> core:: fmt:: Result {
18+ unsafe {
19+ miri_write_to_stdout ( s. as_bytes ( ) ) ;
20+ }
21+ Ok ( ( ) )
22+ }
23+ }
24+
25+ #[ start]
26+ fn start ( _: isize , _: * const * const u8 ) -> isize {
27+ writeln ! ( Host , "hello, world!" ) . unwrap ( ) ;
28+ 0
29+ }
30+
31+ #[ panic_handler]
32+ fn panic_handler ( _: & core:: panic:: PanicInfo ) -> ! {
33+ loop { }
34+ }
You can’t perform that action at this time.
0 commit comments