Skip to content

Commit 08123cb

Browse files
committed
made a testing harness
1 parent bc6c2d6 commit 08123cb

File tree

3 files changed

+116
-11
lines changed

3 files changed

+116
-11
lines changed

.github/workflows/rust.yml

+115-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This checks fmt, clippy, and does build and test on each arch for each impl using cross
2+
13
name: Rust
24

35
on:
@@ -6,17 +8,121 @@ on:
68
pull_request:
79
branches: [ "master" ]
810

9-
env:
10-
CARGO_TERM_COLOR: always
11-
1211
jobs:
13-
build:
12+
style:
13+
name: Check Style
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Install rust
21+
uses: actions-rs/toolchain@v1
22+
with:
23+
toolchain: stable
24+
components: rustfmt
25+
profile: minimal
26+
override: true
1427

28+
- name: Rustfmt check
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: fmt
32+
args: --all --check
33+
34+
test:
1535
runs-on: ubuntu-latest
1636

37+
# TODO: add more platforms (all tier 1 and tier 2, tier 3 testing is optional)
38+
39+
strategy:
40+
matrix:
41+
impl:
42+
- name: AES-NI
43+
target:
44+
- triple: x86_64-unknown-linux-gnu
45+
caps: X86_64_UNKNOWN_LINUX_GNU
46+
- triple: x86_64-pc-windows-msvc
47+
caps: X86_64_UNKNOWN_PC_WINDOWS_MSVC
48+
rustflags: -C target-feature=+sse4.1,+aes
49+
channel: [stable, beta, nightly]
50+
- name: AES-NI with VAES
51+
target:
52+
- triple: x86_64-unknown-linux-gnu
53+
caps: X86_64_UNKNOWN_LINUX_GNU
54+
- triple: x86_64-pc-windows-msvc
55+
caps: X86_64_UNKNOWN_PC_WINDOWS_MSVC
56+
rustflags: -C target-feature=+vaes
57+
channel: [nightly]
58+
- name: AES-NI with VAES and AVX-512
59+
target:
60+
- triple: x86_64-unknown-linux-gnu
61+
caps: X86_64_UNKNOWN_LINUX_GNU
62+
- triple: x86_64-pc-windows-msvc
63+
caps: X86_64_UNKNOWN_PC_WINDOWS_MSVC
64+
rustflags: -C target-feature=+vaes,+avx512f
65+
channel: [nightly]
66+
- name: Neon
67+
target:
68+
- triple: aarch64-unknown-linux-gnu
69+
caps: AARCH64_UNKNOWN_LINUX_GNU
70+
rustflags: -C target-feature=+aes
71+
channel: [stable, beta, nightly]
72+
- name: Risc-V RV64
73+
target:
74+
- triple: riscv64gc-unknown-linux-gnu
75+
caps: RISCV64GC_UNKNOWN_LINUX_GNU
76+
rustflags: -C target-feature=+zkne,+zknd
77+
channel: [nightly]
78+
- name: Risc-V RV32
79+
target:
80+
- triple: riscv32i-unknown-none-elf
81+
caps: RISCV32I_UNKNOWN_NONE_ELF
82+
rustflags: -C target-feature=+zkne,+zknd
83+
channel: [nightly]
84+
- name: Software AES
85+
target:
86+
- triple: x86_64-unknown-linux-gnu
87+
caps: X86_64_UNKNOWN_LINUX_GNU
88+
rustflags: -C target-feature=
89+
channel: [stable, beta, nightly]
90+
include:
91+
- channel: nightly
92+
features: --features=nightly
93+
94+
name: Test ${{ matrix.impl.name }} on ${{ matrix.impl.target.triple }}
95+
1796
steps:
18-
- uses: actions/checkout@v3
19-
- name: Build
20-
run: cargo build --verbose
21-
- name: Run tests
22-
run: cargo test --verbose
97+
- uses: actions/checkout@v3
98+
99+
- name: Install Rust
100+
uses: actions-rs/toolchain@v1
101+
with:
102+
toolchain: ${{ matrix.impl.channel }}
103+
target: ${{ matrix.impl.target.triple }}
104+
profile: minimal
105+
components: clippy
106+
override: true
107+
108+
- run: ${{ format('echo "CROSS_TARGET_{0}_RUSTFLAGS={1}" >> $GITHUB_ENV', matrix.impl.target.caps, matrix.impl.rustflags) }}
109+
110+
- name: Clippy
111+
uses: actions-rs/cargo@v1
112+
with:
113+
command: clippy
114+
args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }}
115+
116+
- name: Build
117+
uses: actions-rs/cargo@v1
118+
with:
119+
use-cross: true
120+
command: build --verbose
121+
args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }}
122+
123+
- name: Test
124+
uses: actions-rs/cargo@v1
125+
with:
126+
use-cross: true
127+
command: test --verbose
128+
args: ${{ format('--target {0} {1}', matrix.impl.target.triple, matrix.features || '') }}

src/aesni_x4.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use core::arch::x86::*;
44
use core::arch::x86_64::*;
55
use core::ops::{BitAnd, BitOr, BitXor, Not};
66

7-
use cfg_if::cfg_if;
8-
97
use crate::aes_x86::AesBlock;
108
use crate::aesni_x2::AesBlockX2;
119

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
),
1818
feature(stdarch_arm_neon_intrinsics)
1919
)]
20+
#![allow(clippy::identity_op)]
2021

2122
use core::fmt::{self, Binary, Debug, Display, Formatter, LowerHex, UpperHex};
2223
use core::ops::{BitAndAssign, BitOrAssign, BitXorAssign};

0 commit comments

Comments
 (0)