Skip to content

Commit

Permalink
run rust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
habnabit committed Jul 5, 2024
1 parent bf7d819 commit 8148e1e
Show file tree
Hide file tree
Showing 28 changed files with 208 additions and 61 deletions.
14 changes: 14 additions & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
branch: true
ignore-not-existing: true
llvm: true
filter: covered
output-type: lcov
output-path: ./lcov.info
# prefix-dir: /home/user/build/
# ignore:
# - "/*"
# - "C:/*"
# - "../*"
# path-mapping:
# - "/path1"
# - "/path2"
22 changes: 16 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
- name: 'run tests'
run: |
tox
- uses: 'coverallsapp/github-action@master'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
file: 'coverage.xml'
format: 'python'

macos:
runs-on: ${{ matrix.runner }}
Expand Down Expand Up @@ -71,16 +76,16 @@ jobs:
- name: 'run tests'
run: |
tox
- uses: 'coverallsapp/github-action@master'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
file: 'coverage.xml'
format: 'python'

windows:
runs-on: ${{ matrix.platform.runner }}
runs-on: 'windows-latest'
strategy:
matrix:
platform:
- runner: windows-latest
target: x64
- runner: windows-latest
target: x86
python-version:
- 'pypy3.9'
- 'pypy3.10'
Expand All @@ -104,3 +109,8 @@ jobs:
- name: 'run tests'
run: |
tox
- uses: 'coverallsapp/github-action@master'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
file: 'coverage.xml'
format: 'python'
36 changes: 36 additions & 0 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'rust tests'

on:
- 'push'
- 'pull_request'

jobs:
lint:
runs-on: '${{ matrix.platform.runner }}'
strategy:
matrix:
platform:
- runner: 'ubuntu-latest'
- runner: 'macos-12'
- runner: 'macos-14'
- runner: 'windows-latest'
steps:
- uses: 'actions/checkout@v1'
- uses: 'actions-rs/toolchain@v1'
with:
toolchain: 'nightly'
override: true
- uses: 'actions-rs/cargo@v1'
with:
command: 'test'
args: '--workspace --no-default-features --features testing-checks'
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- id: 'coverage'
uses: 'actions-rs/grcov@v0.1'
- uses: 'coverallsapp/github-action@master'
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
path-to-lcov: '${{ steps.coverage.outputs.report }}'
103 changes: 95 additions & 8 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ name = "passacre"
version = "1.0.1-rc2"
edition = "2021"

[workspace]
members = [
"tiny-keccak-1536",
"tiny-keccak-1536/comparison",
]

[lib]
name = "_passacre_backend"
crate-type = ["cdylib"]

[features]
default = ["python"]
python = ["pyo3"]
testing-checks = []

[dependencies]
pyo3 = { version = "0.21.1", optional = true }
Expand Down
15 changes: 6 additions & 9 deletions tiny-keccak-1536/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@ categories = ["cryptography", "no-std"]
[dependencies]
crunchy = "0.2.2"

[profile.dev]
opt-level = 3 # Controls the --opt-level the compiler builds with
debug = false # Controls whether the compiler passes `-g`
# [profile.dev]
# opt-level = 3 # Controls the --opt-level the compiler builds with
# debug = false # Controls whether the compiler passes `-g`

[profile.test]
opt-level = 3 # Controls the --opt-level the compiler builds with
debug = false # Controls whether the compiler passes `-g`

[workspace]
members = ["comparison"]
# [profile.test]
# opt-level = 3 # Controls the --opt-level the compiler builds with
# debug = false # Controls whether the compiler passes `-g`

[badges]
travis-ci = { repository = "debris/tiny-keccak", branch = "master"}
Expand Down
2 changes: 1 addition & 1 deletion tiny-keccak-1536/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tiny-keccak = { version = "2.0", features = ["sha3"] }
## Example

```rust
use tiny_keccak::Sha3;
use tiny_keccak_1536::Sha3;

fn main() {
let mut sha3 = Sha3::v256();
Expand Down
2 changes: 1 addition & 1 deletion tiny-keccak-1536/benches/kangaroo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate test;

use test::Bencher;
use tiny_keccak::{KangarooTwelve, Hasher};
use tiny_keccak_1536::{KangarooTwelve, Hasher};

#[bench]
fn bench_k12(b: &mut Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion tiny-keccak-1536/benches/keccak.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extern crate test;

use test::Bencher;
use tiny_keccak::{keccakf, Keccak, Hasher};
use tiny_keccak_1536::{keccakf, Keccak, Hasher};

#[bench]
fn bench_keccak_256_input_4096_bytes(b: &mut Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion tiny-keccak-1536/comparison/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ version = "0.1.0"
authors = ["debris <marek.kotewicz@gmail.com>"]

[dependencies]
tiny-keccak = { path = "../", features = ["sha3"] }
tiny-keccak-1536 = { path = "../", features = ["sha3"] }
sha3 = "0.8.2"
4 changes: 2 additions & 2 deletions tiny-keccak-1536/comparison/benches/sha3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use test::Bencher;

#[bench]
fn tiny_keccak_sha3_256_input_32_bytes(b: &mut Bencher) {
use tiny_keccak::{Sha3, Hasher};
use tiny_keccak_1536::{Sha3, Hasher};
let data = vec![254u8; 32];
b.bytes = data.len() as u64;

Expand All @@ -20,7 +20,7 @@ fn tiny_keccak_sha3_256_input_32_bytes(b: &mut Bencher) {

#[bench]
fn tiny_keccak_sha3_256_input_4096_bytes(b: &mut Bencher) {
use tiny_keccak::{Sha3, Hasher};
use tiny_keccak_1536::{Sha3, Hasher};
let data = vec![254u8; 4096];
b.bytes = data.len() as u64;

Expand Down
2 changes: 1 addition & 1 deletion tiny-keccak-1536/examples/sha3.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use tiny_keccak::{Hasher, Sha3};
use tiny_keccak_1536::{Hasher, Sha3};

fn main() {
let mut sha3 = Sha3::v256();
Expand Down
Loading

0 comments on commit 8148e1e

Please sign in to comment.