Skip to content

Commit 06fdf3d

Browse files
committed
Use mini_core in the tests
1 parent b4418b8 commit 06fdf3d

File tree

12 files changed

+26
-1165
lines changed

12 files changed

+26
-1165
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
- { gcc: "gcc-13.deb" }
2323
- { gcc: "gcc-13-without-int128.deb" }
2424
commands: [
25-
"--mini-tests",
2625
"--std-tests",
2726
# FIXME: re-enable asm tests when GCC can emit in the right syntax.
2827
# "--asm-tests",
@@ -79,6 +78,7 @@ jobs:
7978
run: |
8079
./y.sh prepare --only-libcore
8180
./y.sh build --sysroot
81+
./y.sh test --mini-tests
8282
cargo test
8383
8484
- name: Run y.sh cargo build

.github/workflows/m68k.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
commands: [
26-
"--mini-tests",
2726
"--std-tests",
2827
# TODO(antoyo): fix those on m68k.
2928
#"--test-libcore",
@@ -93,6 +92,7 @@ jobs:
9392
run: |
9493
./y.sh prepare --only-libcore --cross
9594
./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu
95+
./y.sh test --mini-tests
9696
CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test
9797
./y.sh clean all
9898

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ jobs:
5454
run: |
5555
./y.sh prepare --only-libcore
5656
EMBED_LTO_BITCODE=1 ./y.sh build --sysroot --release --release-sysroot
57+
./y.sh test --mini-tests
5758
cargo test
5859
./y.sh clean all
5960

.github/workflows/stdarch.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ jobs:
7373
echo "LD_LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
7474
echo "LIBRARY_PATH="$(./y.sh info | grep -v Using) >> $GITHUB_ENV
7575
76-
- name: Build (part 2)
77-
run: |
78-
cargo test
79-
8076
- name: Clean
8177
if: ${{ !matrix.cargo_runner }}
8278
run: |
@@ -92,6 +88,7 @@ jobs:
9288
if: ${{ !matrix.cargo_runner }}
9389
run: |
9490
./y.sh test --release --clean --release-sysroot --build-sysroot --mini-tests --std-tests --test-libcore
91+
cargo test
9592
9693
- name: Run stdarch tests
9794
if: ${{ !matrix.cargo_runner }}

example/mini_core.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ impl Add for usize {
170170
}
171171
}
172172

173+
impl Add for isize {
174+
type Output = Self;
175+
176+
fn add(self, rhs: Self) -> Self {
177+
self + rhs
178+
}
179+
}
180+
173181
#[lang = "sub"]
174182
pub trait Sub<RHS = Self> {
175183
type Output;

tests/lang_tests_common.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ pub fn main_inner(profile: Profile) {
8989
&format!("{}/build/build_sysroot/sysroot/", current_dir),
9090
"-C",
9191
"link-arg=-lc",
92+
"--extern",
93+
"mini_core=target/out/libmini_core.rlib",
9294
"-o",
9395
exe.to_str().expect("to_str"),
9496
path.to_str().expect("to_str"),

tests/run/array.rs

Lines changed: 2 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,12 @@
77
// 5
88
// 10
99

10-
#![feature(arbitrary_self_types, auto_traits, lang_items, no_core, start, intrinsics, rustc_attrs)]
11-
#![allow(internal_features)]
10+
#![feature(no_core, start)]
1211

1312
#![no_std]
1413
#![no_core]
1514

16-
/*
17-
* Core
18-
*/
19-
20-
// Because we don't have core yet.
21-
#[lang = "sized"]
22-
pub trait Sized {}
23-
24-
#[lang = "copy"]
25-
trait Copy {
26-
}
27-
28-
impl Copy for isize {}
29-
impl Copy for usize {}
30-
impl Copy for i32 {}
31-
impl Copy for u8 {}
32-
impl Copy for i8 {}
33-
impl Copy for i16 {}
34-
impl<T: ?Sized> Copy for *mut T {}
35-
36-
#[lang = "legacy_receiver"]
37-
trait LegacyReceiver {
38-
}
39-
40-
#[lang = "freeze"]
41-
pub(crate) unsafe auto trait Freeze {}
15+
extern crate mini_core;
4216

4317
mod libc {
4418
#[link(name = "c")]
@@ -48,182 +22,6 @@ mod libc {
4822
}
4923
}
5024

51-
#[lang = "index"]
52-
pub trait Index<Idx: ?Sized> {
53-
type Output: ?Sized;
54-
fn index(&self, index: Idx) -> &Self::Output;
55-
}
56-
57-
impl<T> Index<usize> for [T; 3] {
58-
type Output = T;
59-
60-
fn index(&self, index: usize) -> &Self::Output {
61-
&self[index]
62-
}
63-
}
64-
65-
impl<T> Index<usize> for [T] {
66-
type Output = T;
67-
68-
fn index(&self, index: usize) -> &Self::Output {
69-
&self[index]
70-
}
71-
}
72-
73-
#[lang = "drop_in_place"]
74-
#[allow(unconditional_recursion)]
75-
pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
76-
// Code here does not matter - this is replaced by the
77-
// real drop glue by the compiler.
78-
drop_in_place(to_drop);
79-
}
80-
81-
#[lang = "panic"]
82-
#[track_caller]
83-
#[no_mangle]
84-
pub fn panic(_msg: &'static str) -> ! {
85-
unsafe {
86-
libc::puts("Panicking\0" as *const str as *const u8);
87-
intrinsics::abort();
88-
}
89-
}
90-
91-
#[lang = "panic_location"]
92-
struct PanicLocation {
93-
file: &'static str,
94-
line: u32,
95-
column: u32,
96-
}
97-
98-
#[lang = "panic_bounds_check"]
99-
#[track_caller]
100-
#[no_mangle]
101-
fn panic_bounds_check(index: usize, len: usize) -> ! {
102-
unsafe {
103-
libc::printf("index out of bounds: the len is %d but the index is %d\n\0" as *const str as *const i8, len, index);
104-
intrinsics::abort();
105-
}
106-
}
107-
108-
mod intrinsics {
109-
#[rustc_nounwind]
110-
#[rustc_intrinsic]
111-
#[rustc_intrinsic_must_be_overridden]
112-
pub fn abort() -> ! {
113-
loop {}
114-
}
115-
}
116-
117-
#[lang = "add"]
118-
trait Add<RHS = Self> {
119-
type Output;
120-
121-
fn add(self, rhs: RHS) -> Self::Output;
122-
}
123-
124-
impl Add for u8 {
125-
type Output = Self;
126-
127-
fn add(self, rhs: Self) -> Self {
128-
self + rhs
129-
}
130-
}
131-
132-
impl Add for i8 {
133-
type Output = Self;
134-
135-
fn add(self, rhs: Self) -> Self {
136-
self + rhs
137-
}
138-
}
139-
140-
impl Add for i32 {
141-
type Output = Self;
142-
143-
fn add(self, rhs: Self) -> Self {
144-
self + rhs
145-
}
146-
}
147-
148-
impl Add for usize {
149-
type Output = Self;
150-
151-
fn add(self, rhs: Self) -> Self {
152-
self + rhs
153-
}
154-
}
155-
156-
impl Add for isize {
157-
type Output = Self;
158-
159-
fn add(self, rhs: Self) -> Self {
160-
self + rhs
161-
}
162-
}
163-
164-
#[lang = "sub"]
165-
pub trait Sub<RHS = Self> {
166-
type Output;
167-
168-
fn sub(self, rhs: RHS) -> Self::Output;
169-
}
170-
171-
impl Sub for usize {
172-
type Output = Self;
173-
174-
fn sub(self, rhs: Self) -> Self {
175-
self - rhs
176-
}
177-
}
178-
179-
impl Sub for isize {
180-
type Output = Self;
181-
182-
fn sub(self, rhs: Self) -> Self {
183-
self - rhs
184-
}
185-
}
186-
187-
impl Sub for u8 {
188-
type Output = Self;
189-
190-
fn sub(self, rhs: Self) -> Self {
191-
self - rhs
192-
}
193-
}
194-
195-
impl Sub for i8 {
196-
type Output = Self;
197-
198-
fn sub(self, rhs: Self) -> Self {
199-
self - rhs
200-
}
201-
}
202-
203-
impl Sub for i16 {
204-
type Output = Self;
205-
206-
fn sub(self, rhs: Self) -> Self {
207-
self - rhs
208-
}
209-
}
210-
211-
#[track_caller]
212-
#[lang = "panic_const_add_overflow"]
213-
pub fn panic_const_add_overflow() -> ! {
214-
panic("attempt to add with overflow");
215-
}
216-
217-
#[track_caller]
218-
#[lang = "panic_const_sub_overflow"]
219-
pub fn panic_const_sub_overflow() -> ! {
220-
panic("attempt to subtract with overflow");
221-
}
222-
223-
/*
224-
* Code
225-
*/
226-
22725
static mut ONE: usize = 1;
22826

22927
fn make_array() -> [u8; 3] {

0 commit comments

Comments
 (0)