Skip to content

Commit

Permalink
nudge
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay committed Apr 20, 2020
1 parent 200387e commit 965417a
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 121 deletions.
18 changes: 9 additions & 9 deletions ci/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env bash
# #
# # Reference: https://github.com/koalaman/shellcheck/wiki/Directive
# set -e
#
# Reference: https://github.com/koalaman/shellcheck/wiki/Directive
set -e

# cd "$(dirname "$0")/.."
# (
# set -x
# git ls-files -- '*.sh' ':(exclude)ci/semver_bash' \
# | xargs ci/docker-run.sh koalaman/shellcheck@sha256:fe24ab9a9b6b62d3adb162f4a80e006b6a63cae8c6ffafbae45772bab85e7294 --color=always --external-sources --shell=bash
# )
cd "$(dirname "$0")/.."
(
set -x
git ls-files -- '*.sh' ':(exclude)ci/semver_bash' \
| xargs ci/docker-run.sh koalaman/shellcheck@sha256:fe24ab9a9b6b62d3adb162f4a80e006b6a63cae8c6ffafbae45772bab85e7294 --color=always --external-sources --shell=bash
)
echo --- ok
86 changes: 43 additions & 43 deletions ci/test-checks.sh
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
#!/usr/bin/env bash
# set -e

# cd "$(dirname "$0")/.."

# source ci/_
# source ci/rust-version.sh stable
# source ci/rust-version.sh nightly

# export RUST_BACKTRACE=1
# export RUSTFLAGS="-D warnings"

# # Look for failed mergify.io backports
# _ git show HEAD --check --oneline

# _ cargo +"$rust_stable" fmt --all -- --check

# # Clippy gets stuck for unknown reasons if sdk-c is included in the build, so check it separately.
# # See https://github.com/solana-labs/solana/issues/5503
# _ cargo +"$rust_stable" clippy --version
# _ cargo +"$rust_stable" clippy --all --exclude solana-sdk-c -- --deny=warnings
# _ cargo +"$rust_stable" clippy --manifest-path sdk-c/Cargo.toml -- --deny=warnings

# _ cargo +"$rust_stable" audit --version
# _ cargo +"$rust_stable" audit --ignore RUSTSEC-2020-0002 --ignore RUSTSEC-2020-0008
# _ ci/nits.sh
# _ ci/order-crates-for-publishing.py
# _ docs/build.sh
# _ ci/check-ssh-keys.sh

# {
# cd programs/bpf
# _ cargo +"$rust_stable" audit
# for project in rust/*/ ; do
# echo "+++ do_bpf_checks $project"
# (
# cd "$project"
# _ cargo +"$rust_stable" fmt -- --check
# _ cargo +"$rust_nightly" test
# _ cargo +"$rust_nightly" clippy --version
# _ cargo +"$rust_nightly" clippy -- --deny=warnings --allow=clippy::missing_safety_doc
# )
# done
# }
set -e

cd "$(dirname "$0")/.."

source ci/_
source ci/rust-version.sh stable
source ci/rust-version.sh nightly

export RUST_BACKTRACE=1
export RUSTFLAGS="-D warnings"

# Look for failed mergify.io backports
_ git show HEAD --check --oneline

_ cargo +"$rust_stable" fmt --all -- --check

# Clippy gets stuck for unknown reasons if sdk-c is included in the build, so check it separately.
# See https://github.com/solana-labs/solana/issues/5503
_ cargo +"$rust_stable" clippy --version
_ cargo +"$rust_stable" clippy --all --exclude solana-sdk-c -- --deny=warnings
_ cargo +"$rust_stable" clippy --manifest-path sdk-c/Cargo.toml -- --deny=warnings

_ cargo +"$rust_stable" audit --version
_ cargo +"$rust_stable" audit --ignore RUSTSEC-2020-0002 --ignore RUSTSEC-2020-0008
_ ci/nits.sh
_ ci/order-crates-for-publishing.py
_ docs/build.sh
_ ci/check-ssh-keys.sh

{
cd programs/bpf
_ cargo +"$rust_stable" audit
for project in rust/*/ ; do
echo "+++ do_bpf_checks $project"
(
cd "$project"
_ cargo +"$rust_stable" fmt -- --check
_ cargo +"$rust_nightly" test
_ cargo +"$rust_nightly" clippy --version
_ cargo +"$rust_nightly" clippy -- --deny=warnings --allow=clippy::missing_safety_doc
)
done
}

echo --- ok
103 changes: 50 additions & 53 deletions ci/test-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,54 +1,51 @@
#!/usr/bin/env bash

exit 0

# set -e
# cd "$(dirname "$0")/.."

# annotate() {
# ${BUILDKITE:-false} && {
# buildkite-agent annotate "$@"
# }
# }

# ci/affects-files.sh \
# .rs$ \
# Cargo.lock$ \
# Cargo.toml$ \
# ^ci/rust-version.sh \
# ^ci/test-coverage.sh \
# ^scripts/coverage.sh \
# || {
# annotate --style info --context test-coverage \
# "Coverage skipped as no .rs files were modified"
# exit 0
# }

# source ci/upload-ci-artifact.sh
# source scripts/ulimit-n.sh

# scripts/coverage.sh

# report=coverage-"${CI_COMMIT:0:9}".tar.gz
# mv target/cov/report.tar.gz "$report"
# upload-ci-artifact "$report"

# gzip -f target/cov/coverage-stderr.log
# upload-ci-artifact target/cov/coverage-stderr.log.gz

# annotate --style success --context lcov-report \
# "lcov report: <a href=\"artifact://$report\">$report</a>"

# echo "--- codecov.io report"
# if [[ -z "$CODECOV_TOKEN" ]]; then
# echo "^^^ +++"
# echo CODECOV_TOKEN undefined, codecov.io upload skipped
# else
# # We normalize CI to `1`; but codecov expects it to be `true` to detect Buildkite...
# # Unfortunately, codecov.io fails sometimes:
# # curl: (7) Failed to connect to codecov.io port 443: Connection timed out
# CI=true bash <(while ! curl -sS --retry 5 --retry-delay 2 --retry-connrefused https://codecov.io/bash; do sleep 10; done) -Z -X gcov -f target/cov/lcov.info

# annotate --style success --context codecov.io \
# "CodeCov report: https://codecov.io/github/solana-labs/solana/commit/${CI_COMMIT:0:9}"
# fi
set -e
cd "$(dirname "$0")/.."

annotate() {
${BUILDKITE:-false} && {
buildkite-agent annotate "$@"
}
}

ci/affects-files.sh \
.rs$ \
Cargo.lock$ \
Cargo.toml$ \
^ci/rust-version.sh \
^ci/test-coverage.sh \
^scripts/coverage.sh \
|| {
annotate --style info --context test-coverage \
"Coverage skipped as no .rs files were modified"
exit 0
}

source ci/upload-ci-artifact.sh
source scripts/ulimit-n.sh

scripts/coverage.sh

report=coverage-"${CI_COMMIT:0:9}".tar.gz
mv target/cov/report.tar.gz "$report"
upload-ci-artifact "$report"

gzip -f target/cov/coverage-stderr.log
upload-ci-artifact target/cov/coverage-stderr.log.gz

annotate --style success --context lcov-report \
"lcov report: <a href=\"artifact://$report\">$report</a>"

echo "--- codecov.io report"
if [[ -z "$CODECOV_TOKEN" ]]; then
echo "^^^ +++"
echo CODECOV_TOKEN undefined, codecov.io upload skipped
else
# We normalize CI to `1`; but codecov expects it to be `true` to detect Buildkite...
# Unfortunately, codecov.io fails sometimes:
# curl: (7) Failed to connect to codecov.io port 443: Connection timed out
CI=true bash <(while ! curl -sS --retry 5 --retry-delay 2 --retry-connrefused https://codecov.io/bash; do sleep 10; done) -Z -X gcov -f target/cov/lcov.info

annotate --style success --context codecov.io \
"CodeCov report: https://codecov.io/github/solana-labs/solana/commit/${CI_COMMIT:0:9}"
fi
2 changes: 1 addition & 1 deletion cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,7 @@ fn process_deploy(
rpc_client
.send_and_confirm_transaction_with_spinner(&mut finalize_tx, &signers)
.map_err(|e| {
CliError::DynamicProgramError(format!("Program finalize transaction failed: {:?}", e))
CliError::DynamicProgramError(format!("Program finalize transaction failed: {}", e))
})?;

Ok(json!({
Expand Down
8 changes: 0 additions & 8 deletions programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ pub fn process_instruction(
instruction_data: &[u8],
invoke_context: &mut dyn InvokeContext,
) -> Result<(), InstructionError> {
println!("{}:{}", line!(), file!());
solana_logger::setup_with_default("solana=info");

debug_assert!(bpf_loader::check_id(program_id));
Expand All @@ -172,7 +171,6 @@ pub fn process_instruction(
}

if is_executable(keyed_accounts)? {
println!("{}:{}", line!(), file!());
let mut keyed_accounts_iter = keyed_accounts.iter();
let program = next_keyed_account(&mut keyed_accounts_iter)?;

Expand Down Expand Up @@ -217,8 +215,6 @@ pub fn process_instruction(
} else if !keyed_accounts.is_empty() {
match limited_deserialize(instruction_data)? {
LoaderInstruction::Write { offset, bytes } => {
println!("{}:{}", line!(), file!());

let mut keyed_accounts_iter = keyed_accounts.iter();
let program = next_keyed_account(&mut keyed_accounts_iter)?;
if program.signer_key().is_none() {
Expand All @@ -235,13 +231,9 @@ pub fn process_instruction(
program.try_account_ref_mut()?.data[offset..offset + len].copy_from_slice(&bytes);
}
LoaderInstruction::Finalize => {
println!("{}:{}", line!(), file!());

let mut keyed_accounts_iter = keyed_accounts.iter();
let program = next_keyed_account(&mut keyed_accounts_iter)?;

println!("{}:{}", line!(), file!());

if program.signer_key().is_none() {
warn!("key[0] did not sign the transaction");
return Err(InstructionError::MissingRequiredSignature);
Expand Down
7 changes: 0 additions & 7 deletions runtime/src/native_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ impl NativeLoader {
name: &str,
cache: &RwLock<HashMap<String, Symbol<T>>>,
) -> Result<Symbol<T>, InstructionError> {
println!("cache: {:?}", cache);
let mut cache = cache.write().unwrap();
if let Some(entrypoint) = cache.get(name) {
println!("found in cache");
Ok(entrypoint.clone())
} else {
println!("try load");
match Self::library_open(&Self::create_path(&name)) {
Ok(library) => {
let result = unsafe { library.get::<T>(name.as_bytes()) };
Expand Down Expand Up @@ -131,8 +128,6 @@ impl NativeLoader {
instruction_data: &[u8],
invoke_context: &dyn InvokeContext,
) -> Result<(), InstructionError> {
println!("{}:{}", line!(), file!());

let mut keyed_accounts_iter = keyed_accounts.iter();
let program = next_keyed_account(&mut keyed_accounts_iter)?;
let params = keyed_accounts_iter.as_slice();
Expand All @@ -145,8 +140,6 @@ impl NativeLoader {
}
};
trace!("Call native {:?}", name);
println!("program cache: {:?}", self.program_symbol_cache);
println!("loader cache: {:?}", self.loader_symbol_cache);
if name.ends_with("loader_program") {
let entrypoint =
Self::get_entrypoint::<LoaderEntrypoint>(name, &self.loader_symbol_cache)?;
Expand Down

0 comments on commit 965417a

Please sign in to comment.