fate-update.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #! /bin/sh
  2. set -e
  3. base=$(dirname $0)
  4. ref="${base}/ref/fate"
  5. FATE_DB_URL="http://fate.multimedia.cx/fate-tests.sqlite.bz2"
  6. FATE_DB=$(mktemp fate-db.XXXXXX)
  7. SQL_TESTS='SELECT id,short_name,command FROM test_spec WHERE active=1 ORDER BY short_name'
  8. do_sql(){
  9. sqlite3 -noheader -separator ' ' "$FATE_DB" "$@"
  10. }
  11. wget -q -O - "$FATE_DB_URL" | bunzip2 > "$FATE_DB"
  12. mkdir -p "$ref"
  13. exec 3>"$base/fate.mak"
  14. do_sql "$SQL_TESTS" | while read id name command; do
  15. case "$name" in
  16. 00-full-regression|ffmpeg-help|binsize-*) continue ;;
  17. esac
  18. case "$command" in
  19. {MD5}*)
  20. command="${command#*ffmpeg}"; command="${command% -}"
  21. command="md5 $command"
  22. ;;
  23. {*}*) continue ;;
  24. *-f\ framecrc\ -)
  25. command="${command#*ffmpeg}"; command="${command% -f *}"
  26. command="framecrc $command"
  27. ;;
  28. *-f\ framemd5\ -)
  29. command="${command#*ffmpeg}"; command="${command% -f *}"
  30. command="framemd5 $command"
  31. ;;
  32. *-f\ crc\ -)
  33. command="${command#*ffmpeg}"; command="${command% -f *}"
  34. command="crc $command"
  35. ;;
  36. *)
  37. echo "Unhandled command '$command'"
  38. exit 1
  39. ;;
  40. esac
  41. command=$(echo "$command" | sed 's/\$SAMPLES_PATH/$(SAMPLES)/g')
  42. command=$(echo "$command" | sed 's/ *$//')
  43. do_sql "SELECT expected_stdout FROM test_spec WHERE id=$id" | awk '/./{print}' > "$ref/$name"
  44. printf "FATE_TESTS += fate-${name}\n" >&3
  45. printf "fate-${name}: CMD = %s\n" "$command" >&3
  46. done
  47. exec 3<&-
  48. rm -f "$FATE_DB"