Skip to content

Commit

Permalink
rust-rewrite: Ported c-funcpack generator tests to rust integration t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
schilkp committed May 7, 2024
1 parent 49d7662 commit 474f6a3
Show file tree
Hide file tree
Showing 24 changed files with 672 additions and 24 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@ jobs:
with:
toolchain: stable
- uses: carlosperate/arm-none-eabi-gcc-action@v1
- name: Run Generator tests.
run: bash ${{github.workspace}}/reginald_codegen/generator_tests/run_tests.bash
- name: Run old generator tests.
run:
bash ${{github.workspace}}/reginald_codegen/generator_tests/run_tests.bash
- name: Run generator tests.
run:
cargo test -- --ignored
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ out.c
out.rs

testproj/

tarpaulin-report.html
60 changes: 60 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
check:
full_check:
cargo test --workspace
./reginald_codegen/generator_tests/run_tests.bash
REGINALD_TEST_C_FUNCPACK_ADDITIONAL_COMPILERS=arm-none-eabi-gcc cargo test --workspace -- --ignored
cargo fmt --check
cargo clippy --all-features --workspace
@echo "ALL CHECKS OK"

check:
cargo test --workspace
cargo fmt --check
cargo clippy --all-features --workspace
@echo "ALL CHECKS OK"

tokei:
tokei --exclude Unity

cov:
cargo tarpaulin --all-targets --doc --out Html -- --include-ignored
1 change: 1 addition & 0 deletions reginald_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ similar = { version = "2.4.0", features = ["inline"], optional = true }
console = { version = "0.15.8", features = [], optional = true }

[dev-dependencies]
tempfile = "3.10.1"
pretty_assertions = "1.4.0"
4 changes: 0 additions & 4 deletions reginald_codegen/generator_tests/run_tests.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ echo_cyan "=== COMPILE ==="
cargo build
echo_green "DONE"

echo
echo_cyan "=== TESTING C FUNCPACK ==="
bash ./c_funcpack/run_test.bash || fail

echo
echo_cyan "=== TESTING RS STRUCTS ==="
bash ./rs_structs/run_test.bash || fail
Expand Down
2 changes: 1 addition & 1 deletion reginald_codegen/src/cli/cmd/completion.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::io;

use crate::error::Error;
use clap::{CommandFactory, Parser};
use reginald_codegen::error::Error;

use crate::cli::Cli;

Expand Down
10 changes: 5 additions & 5 deletions reginald_codegen/src/cli/cmd/gen.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fs;
use std::path::PathBuf;

use crate::builtin::c;
use crate::builtin::md;
use crate::builtin::rs;
use crate::error::Error;
use crate::regmap::RegisterMap;
use clap::Parser;
use reginald_codegen::builtin::c;
use reginald_codegen::builtin::md;
use reginald_codegen::builtin::rs;
use reginald_codegen::error::Error;
use reginald_codegen::regmap::RegisterMap;

use crate::cli::diff;

Expand Down
2 changes: 1 addition & 1 deletion reginald_codegen/src/cli/cmd/tool.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{fs, path::PathBuf};

use crate::{builtin::rs::CONVERSION_TRAITS, error::Error};
use clap::Parser;
use reginald_codegen::{builtin::rs::CONVERSION_TRAITS, error::Error};

#[derive(Parser, Debug)]
#[command(about = "Built-in tools and utilities")]
Expand Down
2 changes: 1 addition & 1 deletion reginald_codegen/src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mod cmd;
pub mod cmd;
mod diff;

use std::process::ExitCode;
Expand Down
3 changes: 3 additions & 0 deletions reginald_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ pub mod error;
pub mod regmap;
pub mod utils;
pub mod writer;

#[cfg(feature = "cli")]
pub mod cli;
4 changes: 1 addition & 3 deletions reginald_codegen/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use reginald_codegen::cli;
use std::process::ExitCode;

#[cfg(feature = "cli")]
mod cli;

#[cfg(feature = "cli")]
fn main() -> ExitCode {
cli::cli_main()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
output/
artifacts/
.cache/
compile_commands.json
Loading

0 comments on commit 474f6a3

Please sign in to comment.