interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / vendor / curve25519-dalek / tests / build_tests.sh

88 lines · 3629 bytes Raw Blame History
1#!/bin/bash
2
3function match_and_report() {
4 PATTERN=$1
5 FILE=$2
6
7 if grep -q "$PATTERN" "$FILE"; then
8 echo build OK "$FILE" : "$PATTERN"
9 else
10 echo build ERROR "$FILE" : "$PATTERN"
11 echo ">>>>>>>>>>>>>>>>>>>>>>>>>>"
12 cat "$FILE"
13 echo "<<<<<<<<<<<<<<<<<<<<<<<<<<"
14 exit 1
15 fi
16}
17
18# Assuming naively 64 bit host
19cargo clean
20OUT=build_1.txt
21env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\"" cargo build > "$OUT" 2>&1
22match_and_report "curve25519_dalek_backend is 'simd'" "$OUT"
23match_and_report "curve25519_dalek_bits is '64'" "$OUT"
24
25# Override to 32 bits assuming naively 64 bit build host
26cargo clean
27OUT=build_2.txt
28env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_bits=\"32\"" cargo build > "$OUT" 2>&1
29match_and_report "curve25519_dalek_backend is 'serial'" "$OUT"
30match_and_report "curve25519_dalek_bits is '32'" "$OUT"
31
32# Override to 64 bits on 32 bit target
33cargo clean
34OUT=build_3.txt
35env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_bits=\"64\"" cargo build --target i686-unknown-linux-gnu > "$OUT" 2>&1
36match_and_report "curve25519_dalek_backend is 'serial'" "$OUT"
37match_and_report "curve25519_dalek_bits is '64'" "$OUT"
38
39# 32 bit target default
40cargo clean
41OUT=build_4.txt
42env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\"" cargo build --target i686-unknown-linux-gnu > "$OUT" 2>&1
43match_and_report "curve25519_dalek_backend is 'serial'" "$OUT"
44match_and_report "curve25519_dalek_bits is '32'" "$OUT"
45
46# wasm 32 bit target default
47cargo clean
48OUT=build_5.txt
49env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\"" cargo build --target wasm32-unknown-unknown > "$OUT" 2>&1
50match_and_report "curve25519_dalek_backend is 'serial'" "$OUT"
51match_and_report "curve25519_dalek_bits is '32'" "$OUT"
52
53# wasm 32 bit target default
54# Attempted override w/ "simd" should result "serial" addition
55cargo clean
56OUT=build_5_1.txt
57env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_backend=\"simd\"" cargo build --target wasm32-unknown-unknown > "$OUT" 2>&1
58# This overide must fail the compilation since "simd" is not available
59# See: issues/532
60match_and_report "Could not override curve25519_dalek_backend to simd" "$OUT"
61
62# fiat override with default 64 bit naive host assumption
63cargo clean
64OUT=build_6.txt
65env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_backend=\"fiat\"" cargo build > "$OUT" 2>&1
66match_and_report "curve25519_dalek_backend is 'fiat'" "$OUT"
67match_and_report "curve25519_dalek_bits is '64'" "$OUT"
68
69# fiat 32 bit override
70cargo clean
71OUT=build_7.txt
72env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_backend=\"fiat\" --cfg curve25519_dalek_bits=\"32\"" cargo build > "$OUT" 2>&1
73match_and_report "curve25519_dalek_backend is 'fiat'" "$OUT"
74match_and_report "curve25519_dalek_bits is '32'" "$OUT"
75
76# serial override with default 64 bit naive host assumption
77cargo clean
78OUT=build_8.txt
79env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_backend=\"serial\"" cargo build > "$OUT" 2>&1
80match_and_report "curve25519_dalek_backend is 'serial'" "$OUT"
81match_and_report "curve25519_dalek_bits is '64'" "$OUT"
82
83# serial 32 bit override
84cargo clean
85OUT=build_9.txt
86env RUSTFLAGS="--cfg curve25519_dalek_diagnostics=\"build\" --cfg curve25519_dalek_backend=\"serial\" --cfg curve25519_dalek_bits=\"32\"" cargo build > "$OUT" 2>&1
87match_and_report "curve25519_dalek_backend is 'serial'" "$OUT"
88match_and_report "curve25519_dalek_bits is '32'" "$OUT"