Skip to content

Commit

Permalink
ci: test all parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
desbma-s1n committed Jun 3, 2024
1 parent b910bbc commit c90328b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,28 @@ jobs:

test:
runs-on: ubuntu-latest
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
matrix:
- strace-parser: [combinator, peg, regex]
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
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
Expand Down
9 changes: 4 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions src/strace/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c90328b

Please sign in to comment.