Skip to content

Commit

Permalink
Per PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Apr 8, 2024
1 parent ee35a34 commit 3c03987
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions aws-lc-fips-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions aws-lc-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
5 changes: 3 additions & 2 deletions scripts/build/collect_build_src.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 3c03987

Please sign in to comment.