dirty fix to run tests

master
histausse 2 years ago
parent 037c48fba0
commit 342e21218f
Signed by: histausse
GPG Key ID: 67486F107F62E9E9

@ -91,12 +91,14 @@ def task_install_dep():
def task_compile():
""" Compile the sources.
"""
return {
task = {
'file_dep': get_build_dep(),
'targets': [f'{consts.WORK_DIR}/target/{consts.TARGET}/release/kernel'],
'actions': [f'RUSTFLAGS="{consts.RUSTC_FLAGS}" cargo rustc --target={consts.TARGET} {consts.CARGO_COMPILE_FLAGS}'],
'clean': [f'cargo clean']
}
print(task)
return task
def task_build():
""" Strip the binary from ELF format to raw binary.

@ -5,8 +5,8 @@
//! but it's a project for discovering rust on embedded, so its architecture is less generic and
//! I'm trying to reuse knowledge from Telecom-Paris SE203 class as much as I can.
#![no_main]
#![no_std]
#![cfg_attr(not(test), no_main)]
#![cfg_attr(not(test), no_std)]
#![feature(format_args_nl)]
#![feature(panic_info_message)]
@ -16,19 +16,26 @@ mod traits;
mod bsp;
mod utils;
#[cfg(not(test))]
mod panic;
#[cfg(not(test))]
mod print;
#[cfg(not(test))]
use core::arch::global_asm;
#[cfg(not(test))]
use core::arch::asm;
// TODO: handle this with features
//use crate::bsp::qemu::console::console;
#[cfg(not(test))]
use crate::bsp::rpi3::uart::console;
#[cfg(not(test))]
use crate::bsp::rpi3::gpio;
// TODO: move this to BSP
/// Pause the core with a infinit loop
#[cfg(not(test))]
#[inline(always)]
pub fn wait_forever() -> ! {
loop {
@ -37,9 +44,11 @@ pub fn wait_forever() -> ! {
}
// TODO: move this to BSP
#[cfg(not(test))]
global_asm!(include_str!("boot.s"));
/// Start the rust part of the kernel
#[cfg(not(test))]
#[no_mangle]
pub unsafe fn _start_rust() -> ! {
@ -85,3 +94,6 @@ pub unsafe fn _start_rust() -> ! {
panic!("Paniccccccc")
*/
}
#[cfg(test)]
fn main() {}

@ -81,3 +81,14 @@ impl Field {
self.mask
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn test() {
let f = Field::new(0, 0, 1);
assert_eq!(1, f.get_mask());
}
}

Loading…
Cancel
Save