From 58bc43b6597aa5983e7ec86af746b4a837bda6e7 Mon Sep 17 00:00:00 2001 From: desbma-s1n Date: Mon, 3 Jun 2024 18:02:19 +0200 Subject: [PATCH] ci: test all parsers --- .github/workflows/ci.yml | 15 ++++++++++++--- Cargo.toml | 9 ++++----- src/strace/parser/mod.rs | 12 ++++++------ 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 468f0b4..e18ed57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,26 +8,35 @@ env: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + strace-parser: [combinator, peg, regex] steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable - - run: cargo build --verbose + - run: cargo build --no-default-features --features strace-parser-${{matrix.strace-parser}} --verbose test: runs-on: ubuntu-latest + strategy: + matrix: + strace-parser: [combinator, peg, regex] steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable - - run: cargo test --bins --verbose + - run: cargo test --bins --no-default-features --features strace-parser-${{matrix.strace-parser}} --verbose clippy: runs-on: ubuntu-latest + strategy: + matrix: + strace-parser: [combinator, peg, regex] steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 @@ -35,7 +44,7 @@ jobs: profile: minimal toolchain: stable components: clippy - - run: cargo clippy -- -D warnings + - run: cargo clippy --no-default-features --features strace-parser-${{matrix.strace-parser}} -- -D warnings fmt: runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index e676f02..775b6e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,13 +39,12 @@ predicates = { version = "3.0.3", default-features = false, features = ["color"] pretty_assertions = { version = "1.4.0", default-features = false, features = ["std"] } [features] -default = ["parser-combinator"] +default = ["strace-parser-combinator"] as-root = [] # for tests only nightly = [] # for benchmarks only -parser-combinator = ["dep:function_name", "dep:nom"] -parser-peg = ["dep:pest", "dep:pest_derive"] -parser-regex = [] -function_name = ["dep:function_name"] +strace-parser-combinator = ["dep:function_name", "dep:nom"] +strace-parser-peg = ["dep:pest", "dep:pest_derive"] +strace-parser-regex = [] [lints.rust] missing_docs = "warn" diff --git a/src/strace/parser/mod.rs b/src/strace/parser/mod.rs index a5f8380..91d6f6a 100644 --- a/src/strace/parser/mod.rs +++ b/src/strace/parser/mod.rs @@ -8,18 +8,18 @@ use std::{ use crate::strace::Syscall; -#[cfg(feature = "parser-combinator")] +#[cfg(feature = "strace-parser-combinator")] mod combinator; -#[cfg(feature = "parser-peg")] +#[cfg(feature = "strace-parser-peg")] mod peg; -#[cfg(feature = "parser-regex")] +#[cfg(feature = "strace-parser-regex")] mod regex; -#[cfg(feature = "parser-combinator")] +#[cfg(feature = "strace-parser-combinator")] use combinator::parse_line; -#[cfg(feature = "parser-peg")] +#[cfg(feature = "strace-parser-peg")] use peg::parse_line; -#[cfg(feature = "parser-regex")] +#[cfg(feature = "strace-parser-regex")] use regex::parse_line; pub struct LogParser {