Skip to content

Instantly share code, notes, and snippets.

@kowey
Last active December 11, 2015 17:19
Show Gist options
  • Save kowey/4633875 to your computer and use it in GitHub Desktop.
Save kowey/4633875 to your computer and use it in GitHub Desktop.
cat_bundle () {
file=$1
echo ""
echo ""
echo "; ----------------------------------------------------------------------"
echo "; $(basename $file)"
echo "; ----------------------------------------------------------------------"
echo ""
cat $file
}
echo
echo "SUMMARY"
echo "-------"
T=$(mktemp -d -t aura-test.XXXX)
mkdir -p dist
rm -f dist/tmp
ln -s $T dist/tmp
for i in output/batch/*.bundles.output; do
BUNDLE=$(basename $i .output)
mkdir $T/$BUNDLE
grep -rl "Status code: 400" $i | sed -e "s!$i/!!" > $T/$BUNDLE/awful-input
grep -rl "NO RESULTS" $i | sed -e "s!$i/!!" > $T/$BUNDLE/no-results
NUM_BAD=$(wc -l $T/$BUNDLE/no-results | awk '{print $1}')
NUM_AWFUL=$(wc -l $T/$BUNDLE/awful-input | awk '{print $1}')
echo $BUNDLE $NUM_BAD bad $NUM_AWFUL awful
TB=$T/$(basename $BUNDLE .bundles)
if [ $NUM_AWFUL -gt 0 ]; then
for bad in $(cat $T/$BUNDLE/awful-input); do
cat_bundle output/batch/$BUNDLE.input/$bad
done
fi >> $TB.awful-input.bundles
if [ $NUM_BAD -gt 0 ]; then
for bad in $(cat $T/$BUNDLE/no-results); do
cat_bundle output/batch/$BUNDLE.input/$bad
done
fi >> $TB.no-results.bundles
done | column -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment