Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ledger: codecov #1885

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ flags:
carryforward: true
ledgers:
carryforward: true
nightly_ledgers:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

carry forward doesn't seem to work yet with my setup, need to look into

carryforward: true
4 changes: 2 additions & 2 deletions src/flamenco/runtime/tests/run_ledger_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ PROTO_BUF_FAILURE=0
TILE_CPUS="--tile-cpus 5-21"

POSITION_ARGS=()
OBJDIR=${OBJDIR:-build/native/gcc}
OBJDIR=${OBJDIR:-build/native/clang}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default should stay gcc.


while [[ $# -gt 0 ]]; do
case $1 in
Expand Down Expand Up @@ -211,7 +211,7 @@ while [[ $# -gt 0 ]]; do
done


export LLVM_PROFILE_FILE=$OBJDIR/cov/raw/ledger_test_$LEDGER.profraw
export LLVM_PROFILE_FILE=$OBJDIR/cov/raw/ledger_test_$$.profraw
mkdir -p $OBJDIR/cov/raw

if [[ ! -e dump/$CHECKPT && SKIP_INGEST -eq 1 ]]; then
Expand Down
28 changes: 21 additions & 7 deletions src/flamenco/runtime/tests/run_nightly_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ while [[ $# -gt 0 ]]; do
SLACK_WEBHOOK_URL="$2"
shift 2
;;
-cc|--codecov-token)
CODECOV_TOKEN="$2"
shift 2
;;
*)
echo "Unknown flag"
exit 1
Expand All @@ -36,6 +40,11 @@ if [ -z "${SLACK_WEBHOOK_URL}" ]; then
exit 1
fi

if [ -z "${CODECOV_TOKEN}" ]; then
echo "Error: Codecov token not specified"
exit 1
fi

# Pull the latest code
cd $REPO_DIR
git checkout $BRANCH
Expand All @@ -53,17 +62,13 @@ EOF
curl -X POST -H 'Content-type: application/json' --data "$start_json_payload" $SLACK_WEBHOOK_URL

# Set up environment
PATH=/opt/rh/gcc-toolset-12/root/usr/bin:$PATH
export PATH
PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$PKG_CONFIG_PATH

make distclean && make clean
./deps.sh nuke
echo "y" | ./deps.sh +dev
make -j
make -j CC=clang EXTRAS=llvm-cov

# Run the test
make run-runtime-test-nightly > ~/run_nightly_tests.txt
make run-runtime-test-nightly -j CC=clang EXTRAS=llvm-cov > ~/run_nightly_tests.txt
status=$?

# Notify the test status
Expand All @@ -90,14 +95,14 @@ for log_info in "${log_infos[@]}"; do
if [[ -n "$mismatched" ]]; then
mismatch_slot=$(grep "Bank hash mismatch!" "$log_file" | tail -n 1 | awk -F'slot=' '{print $2}' | awk '{print $1}')
end_message+=$'\n'" - Ledger \`$ledger\` Starting at Slot \`$start_slot\` Failed at Slot \`$mismatch_slot\`, Log at: \`$log_file\`"
./src/flamenco/runtime/tests/run_conformance_tests.sh -i /data/insn_pb/ -fdr $REPO_DIR -fdb $BRANCH
else
replay_completed=$(grep "replay completed" "$log_file" | tail -n 1)
info="${replay_completed#*replay completed - }"
end_message+=$'\n'" - Ledger \`$ledger\` Starting at Slot \`$start_slot\` Passed: $info"
fi
done

./src/flamenco/runtime/tests/run_conformance_tests.sh -i /data/insn_pb/ -fdr $REPO_DIR -fdb $BRANCH

json_payload=$(cat <<EOF
{
Expand All @@ -107,3 +112,12 @@ json_payload=$(cat <<EOF
EOF
)
curl -X POST -H 'Content-type: application/json' --data "$json_payload" $SLACK_WEBHOOK_URL

OBJDIR=${OBJDIR:-build/native/clang}
find "${REPO_DIR}/${OBJDIR}/cov/raw" -name '*.profraw' -print0 | xargs -0 llvm-profdata merge --sparse -o "${REPO_DIR}/${OBJDIR}/cov/raw/codecov.profdata"
llvm-cov export -format=lcov -instr-profile=${REPO_DIR}/${OBJDIR}/cov/raw/codecov.profdata ${REPO_DIR}/${OBJDIR}/bin/fd_ledger > ${REPO_DIR}/${OBJDIR}/cov/raw/codecov.lcov

curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -f ${REPO_DIR}/${OBJDIR}/cov/raw/codecov.lcov -t $CODECOV_TOKEN -F nightly_ledgers --name dist-cov-nightly-report
rm codecov