From 3c03987539629887eced705371d834bd2f7d3338 Mon Sep 17 00:00:00 2001 From: Justin Smith Date: Fri, 5 Apr 2024 13:33:02 -0400 Subject: [PATCH] Per PR feedback --- aws-lc-fips-sys/builder/main.rs | 5 +++-- aws-lc-sys/builder/main.rs | 5 +++-- scripts/build/collect_build_src.sh | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/aws-lc-fips-sys/builder/main.rs b/aws-lc-fips-sys/builder/main.rs index 3bf7503262d..ef0d9f866ef 100644 --- a/aws-lc-fips-sys/builder/main.rs +++ b/aws-lc-fips-sys/builder/main.rs @@ -144,13 +144,14 @@ pub(crate) struct TestCommandResult { status: bool, } +const MAX_CMD_OUTPUT_SIZE: usize = 1 << 12; fn test_command(executable: &OsStr, args: &[&OsStr]) -> TestCommandResult { if let Ok(mut result) = Command::new(executable).args(args).output() { - result.stderr.truncate(4112); + result.stderr.truncate(MAX_CMD_OUTPUT_SIZE); let stderr = String::from_utf8(result.stderr) .unwrap_or_default() .into_boxed_str(); - result.stdout.truncate(4112); + result.stdout.truncate(MAX_CMD_OUTPUT_SIZE); let stdout = String::from_utf8(result.stdout) .unwrap_or_default() .into_boxed_str(); diff --git a/aws-lc-sys/builder/main.rs b/aws-lc-sys/builder/main.rs index e5280a9e76c..c4e0761178b 100644 --- a/aws-lc-sys/builder/main.rs +++ b/aws-lc-sys/builder/main.rs @@ -142,13 +142,14 @@ pub(crate) struct TestCommandResult { status: bool, } +const MAX_CMD_OUTPUT_SIZE: usize = 1 << 12; fn test_command(executable: &OsStr, args: &[&OsStr]) -> TestCommandResult { if let Ok(mut result) = Command::new(executable).args(args).output() { - result.stderr.truncate(4112); + result.stderr.truncate(MAX_CMD_OUTPUT_SIZE); let stderr = String::from_utf8(result.stderr) .unwrap_or_default() .into_boxed_str(); - result.stdout.truncate(4112); + result.stdout.truncate(MAX_CMD_OUTPUT_SIZE); let stdout = String::from_utf8(result.stdout) .unwrap_or_default() .into_boxed_str(); diff --git a/scripts/build/collect_build_src.sh b/scripts/build/collect_build_src.sh index 6c208d4d99b..5aa0d01966f 100755 --- a/scripts/build/collect_build_src.sh +++ b/scripts/build/collect_build_src.sh @@ -149,7 +149,7 @@ function verify_source_files() { done } -function generate_toml() { +function generate_output() { TIMESTAMP="$(date -u)" cat << EOF // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. @@ -160,6 +160,7 @@ use crate::cc_builder::Library; pub(super) const CRYPTO_LIBRARY: Library = Library { name: "crypto", + // This attribute is intentionally let blank flags: &[], sources: &[ EOF @@ -207,7 +208,7 @@ verify_source_files "${PROCESSED_SRC_FILES[@]}" RUST_TRIPLE=$(target_filename) BUILD_CFG_PATH="${BUILD_CFG_DIR}/${RUST_TRIPLE}.rs" -generate_toml ${PROCESSED_SRC_FILES[@]} > ${BUILD_CFG_PATH} +generate_output ${PROCESSED_SRC_FILES[@]} > ${BUILD_CFG_PATH} echo echo Build configuration written to: ${BUILD_CFG_PATH}