diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..86162aa5bed73895b3fcec2b00cba0f6b41d72fd --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,4 @@ +[workspace] +members = [ + "re2", +] diff --git a/ci/00-pre.sh b/ci/00-pre.sh new file mode 100755 index 0000000000000000000000000000000000000000..e5b0c7f686eda3b4eda57dd3bff3005ece885349 --- /dev/null +++ b/ci/00-pre.sh @@ -0,0 +1,11 @@ +#!/bin/bash +sudo yum clean all +sudo yum install -y gcc openssl-libs + +#git操作加速并安装rust工具链 +git config --global url."https://github.91chi.fun/https://github.com/".insteadOf "https://github.com/" +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustlang.sh +sh rustlang.sh -y + +source ~/.bashrc + diff --git a/ci/01-base.sh b/ci/01-base.sh new file mode 100755 index 0000000000000000000000000000000000000000..5b3bdd52de59dd36bce31dab3da2fe52df0fe4ce --- /dev/null +++ b/ci/01-base.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +#开始执行检查 +cargo fmt --all -- --check -v +cargo clean + +cargo clippy --all-targets --all-features --tests --benches -- -v +cargo clean + +cargo check +cargo clean + +bins=$(sed -n '/[[bin]]/ {n;p}' Cargo.toml | sed 's/\"//g' | sed 's/name = //g') +for rust_bin in $bins +do +echo $rust_bin +cargo rustc --bin $rust_bin -- -D warnings -v +done + +cargo build --release -v + +RUST_BACKTRACE=1 cargo test --all -- --nocapture + +cargo doc --all --no-deps diff --git a/ci/02-examples.sh b/ci/02-examples.sh new file mode 100755 index 0000000000000000000000000000000000000000..01286b0f493d25da6f2d3920cce68557fb3990f5 --- /dev/null +++ b/ci/02-examples.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +#RUST_BACKTRACE=1 cargo run --example signals diff --git a/ci/README.md b/ci/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a8e6dca697ff006652657b911eaaf3ce18efd4cf --- /dev/null +++ b/ci/README.md @@ -0,0 +1,9 @@ +# 此处为门禁测试脚本 + +## 1. 00-pre.sh为环境准备脚本,在门禁的最开始执行. + +## 2. [0-9]开头的脚本, 以字典序依次串行执行. 可自行添加或修改对应脚本. + +- 脚本以两位数字开头,.sh结尾, 按字典序排列 +- 每个脚本对应一个完整的测试用例,负责环境的准备和清理 +- 脚本一旦出现非0返回值就会报错退出 \ No newline at end of file diff --git a/re2/Cargo.toml b/re2/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..dcd72cf2dfe3dfba4e1fb1c113822b42c88f6110 --- /dev/null +++ b/re2/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "re2" +version = "0.1.0" +authors = ["seuzw <930zhaowei@163.com>"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = ["lib"] +path = "re2.rs" +name = "re2" + +toml = "0.5.8" +serde_derive = "1.0.130" +serde = "1.0.130" +log = "0.4" +log4rs = "1.0" +thiserror = "1.0" +anyhow = "1.0" +http = "0.2.6" +procfs = "0.12.0" +nix = "0.23.0" +pathdiff = "0.2.1" diff --git a/re2/re2.rs b/re2/re2.rs new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/re2/re2.rs @@ -0,0 +1 @@ +