test_bindings_gen_all.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. # ** NOTICE **
  3. # If it exists, this script deletes the "./_gen_all_test"
  4. # directory before attempting to download and convert new files.
  5. shopt -s nocaseglob #ignore case for filename matches
  6. shopt -s nullglob #if no matches return a null string
  7. SCRIPT_DIR="$(dirname "$0")"
  8. DEST_DIR="$SCRIPT_DIR/_gen_all_test"
  9. TIMESTAMP=$(date +%F@%H%M) #Example format: 2006-09-15@1228
  10. LOG_FILE="$DEST_DIR/${TIMESTAMP}-$(basename "$0").txt" #log file with same name as script
  11. rm -r "$DEST_DIR" &> /dev/null
  12. mkdir "$DEST_DIR" &> /dev/null
  13. {
  14. echo "Run Timestamp: $TIMESTAMP"
  15. echo "Using Google API Converter: " $("$SCRIPT_DIR/googleapiconv" --version)
  16. echo
  17. # Use option --verbose for more messages
  18. echo "googleapiconv --all --icon --keepjson --timestamp --output=$DEST_DIR/"
  19. "$SCRIPT_DIR/googleapiconv" --all --icon --keepjson --timestamp --output="$DEST_DIR/"
  20. # Check to see if we have any missing generated .pp files
  21. echo ""
  22. ((COUNT=0))
  23. for FILE in "$DEST_DIR/"*.json; do
  24. JSON_NAME="${FILE##*/}"
  25. PASCAL_NAME="${JSON_NAME%.*}.pp"
  26. if [ ! -s "$DEST_DIR/$PASCAL_NAME" ]; then
  27. echo "** Missing or empty file: JSON file $JSON_NAME did not generate $PASCAL_NAME"
  28. ((COUNT++))
  29. fi
  30. done
  31. echo "Missing File Count = $COUNT"
  32. } |& tee "$LOG_FILE" #output both stdout and stderr to logfile and terminal