Skip to content

Commit dc07058

Browse files
authored
Run compiler tests on ubuntu-22.04 (#718)
1 parent b18e227 commit dc07058

File tree

4 files changed

+44
-23
lines changed

4 files changed

+44
-23
lines changed

.github/workflows/compilers.yml

+34-13
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
aws-lc-rs-2004-gcc:
2424
if: github.repository_owner == 'aws'
2525
name: GCC ${{ matrix.gcc_version }} - CMake ${{ matrix.cmake }} - FIPS ${{ matrix.fips }}
26-
runs-on: ubuntu-20.04
26+
runs-on: ubuntu-22.04
27+
container:
28+
image: ubuntu:20.04
2729
env:
2830
AWS_LC_SYS_CMAKE_BUILDER: ${{ matrix.cmake }}
2931
strategy:
@@ -33,9 +35,27 @@ jobs:
3335
gcc_version: [ '7', '8' ]
3436
fips: [ '0', '1' ]
3537
steps:
36-
- uses: actions/checkout@v4
37-
with:
38-
submodules: 'recursive'
38+
- run: |
39+
apt-get update
40+
apt-get install -y ca-certificates
41+
apt-get install -y cmake curl sudo
42+
apt-get install -y --no-install-recommends gpg-agent software-properties-common
43+
apt-add-repository --yes ppa:git-core/ppa
44+
add-apt-repository --yes ppa:longsleep/golang-backports
45+
apt-get update
46+
apt-get install -y build-essential git golang-go
47+
curl -L -O -J https://github.com/PowerShell/PowerShell/releases/download/v7.2.23/powershell_7.2.23-1.deb_amd64.deb
48+
dpkg -i powershell_7.2.23-1.deb_amd64.deb
49+
apt-get install -f
50+
rm powershell_7.2.23-1.deb_amd64.deb
51+
- name: Checkout
52+
run: |
53+
mkdir -p /tmp/aws-lc-rs
54+
git config --global --add safe.directory '*'
55+
git clone --recursive ${{ github.server_url }}/${{ github.repository }}.git /tmp/aws-lc-rs
56+
cd /tmp/aws-lc-rs
57+
git fetch origin ${{ github.sha }}
58+
git checkout --recurse-submodules -b ci-job ${{ github.sha }}
3959
- uses: dtolnay/rust-toolchain@master
4060
id: toolchain
4161
with:
@@ -45,42 +65,43 @@ jobs:
4565
with:
4666
version: ${{ matrix.gcc_version }}
4767
platform: x64
48-
- if: matrix.fips == '1'
49-
uses: actions/setup-go@v4
50-
with:
51-
go-version: '>=1.18'
5268
- name: Run cargo test (debug)
69+
working-directory: /tmp/aws-lc-rs/
5370
run: cargo test -p aws-lc-rs --all-targets --no-default-features --features ${{ (matrix.fips == '0' && 'unstable,aws-lc-sys') || 'unstable,fips' }}
5471
- name: Run cargo test (release)
72+
working-directory: /tmp/aws-lc-rs/
5573
run: cargo test -p aws-lc-rs --release --all-targets --no-default-features --features ${{ (matrix.fips == '0' && 'unstable,aws-lc-sys') || 'unstable,fips' }}
5674
# The steps below verify that we're successfully using `-ffile-prefix-map`
5775
# to remove build environment paths from the resulting library.
5876
- if: ${{ matrix.gcc_version == '8' }}
77+
working-directory: /tmp/aws-lc-rs/
5978
name: Verify paths found in debug build
6079
run: |
6180
DEBUG_LIBCRYPTO=$(find ./target/debug -name "libaws_lc_*_crypto.a")
62-
if strings ${DEBUG_LIBCRYPTO} | grep runner; then
81+
if strings ${DEBUG_LIBCRYPTO} | grep '/tmp/aws-lc-rs/'; then
6382
exit 0; # SUCCESS
6483
else
65-
exit 1; # FAIL - we expected to find "runner" (i.e., a path)
84+
strings ${DEBUG_LIBCRYPTO}
85+
exit 1; # FAIL - we expected to find "/tmp/aws-lc-rs/" (i.e., a path)
6686
fi
6787
# TODO: Due to the nature of the FIPS build (e.g., its dynamic generation of
6888
# assembly files and its custom compilation commands within CMake), not all
6989
# source paths are stripped from the resulting binary.
7090
- if: ${{ matrix.gcc_version == '8' && matrix.fips == '0' }}
91+
working-directory: /tmp/aws-lc-rs/
7192
name: Verify paths not found in release build
7293
run: |
7394
RELEASE_LIBCRYPTO=$(find ./target/release -name "libaws_lc_*_crypto.a")
74-
if strings ${RELEASE_LIBCRYPTO} | grep runner; then
75-
exit 1; # FAIL - we did not expect to find "runner" (i.e., a path)
95+
if strings ${RELEASE_LIBCRYPTO} | grep '/tmp/aws-lc-rs/'; then
96+
exit 1; # FAIL - we did not expect to find "/tmp/aws-lc-rs/" (i.e., a path)
7697
else
7798
exit 0; # SUCCESS
7899
fi
79100
80101
aws-lc-rs-1804-gcc:
81102
if: github.repository_owner == 'aws'
82103
name: GCC ${{ matrix.gcc_version }} - CMake ${{ matrix.cmake }} - FIPS ${{ matrix.fips }}
83-
runs-on: ubuntu-20.04
104+
runs-on: ubuntu-22.04
84105
container:
85106
image: ubuntu:18.04
86107
env:

aws-lc-rs/src/agreement.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ use crate::ec::encoding::sec1::{
5555
marshal_sec1_private_key, marshal_sec1_public_point, marshal_sec1_public_point_into_buffer,
5656
parse_sec1_private_bn,
5757
};
58-
use crate::ec::{encoding, evp_key_generate, };
59-
#[cfg(not(feature = "fips"))]
60-
use crate::ec::verify_evp_key_nid;
6158
#[cfg(feature = "fips")]
6259
use crate::ec::validate_evp_key;
60+
#[cfg(not(feature = "fips"))]
61+
use crate::ec::verify_evp_key_nid;
62+
use crate::ec::{encoding, evp_key_generate};
6363
use crate::error::{KeyRejected, Unspecified};
6464
use crate::hex;
6565
use crate::ptr::ConstPointer;

aws-lc-sys/builder/cc_builder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ impl CcBuilder {
285285
emit_warning("######");
286286
emit_warning("###### WARNING: MISSING GIT SUBMODULE ######");
287287
emit_warning(&format!(
288-
" -- Did you initialize the repo's git submodules? Unable to find source file: {:?}.",
289-
&source_file
288+
" -- Did you initialize the repo's git submodules? Unable to find source file: {}.",
289+
source_file.display()
290290
));
291291
emit_warning(" -- run 'git submodule update --init --recursive' to initialize.");
292292
emit_warning("######");
@@ -310,7 +310,7 @@ impl CcBuilder {
310310
ret_val = true;
311311
}
312312
if fs::remove_dir_all(&output_dir).is_err() {
313-
emit_warning(&format!("Failed to remove {:?}", &output_dir));
313+
emit_warning(&format!("Failed to remove {}", output_dir.display()));
314314
}
315315
emit_warning(&format!(
316316
"Compilation of '{basename}.c' {} - {:?}.",
@@ -354,14 +354,14 @@ impl CcBuilder {
354354
execute_command(memcmp_compiler.path().as_os_str(), memcmp_args.as_slice());
355355
assert!(
356356
memcmp_compile_result.status,
357-
"COMPILER: {:?}\
357+
"COMPILER: {}\
358358
ARGS: {:?}\
359359
EXECUTED: {}\
360360
ERROR: {}\
361361
OUTPUT: {}\
362362
Failed to compile {basename}
363363
",
364-
memcmp_compiler.path(),
364+
memcmp_compiler.path().display(),
365365
memcmp_args.as_slice(),
366366
memcmp_compile_result.executed,
367367
memcmp_compile_result.stderr,

aws-lc-sys/builder/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,8 @@ fn main() {
616616
emit_warning("######");
617617
emit_warning("###### WARNING: MISSING GIT SUBMODULE ######");
618618
emit_warning(&format!(
619-
" -- Did you initialize the repo's git submodules? Unable to find crypto directory: {:?}.",
620-
&aws_lc_crypto_dir
619+
" -- Did you initialize the repo's git submodules? Unable to find crypto directory: {}.",
620+
&aws_lc_crypto_dir.display()
621621
));
622622
emit_warning(" -- run 'git submodule update --init --recursive' to initialize.");
623623
emit_warning("######");

0 commit comments

Comments
 (0)