《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 line
883 B

  1. #!/bin/bash
  2. BASE_COMMIT=95a80f598fc57c60aed3737c60ee437d94eb8540
  3. LABS=`git diff $BASE_COMMIT --stat | grep -o "lab[0-9]" | uniq`
  4. if [ "$LABS" = "" ]; then
  5. echo "No solutions provided. Skip this time."
  6. exit 0
  7. fi
  8. failed=0
  9. pwd=`pwd`
  10. summary=$pwd/.score_summary
  11. echo -n > $summary
  12. for lab in $LABS; do
  13. pushd $lab > /dev/null
  14. if ! make grade > .score 2>&1; then
  15. failed=`echo $lab | grep -o [0-9]`
  16. fi
  17. score=`egrep -o "Score: [0-9]+/[0-9]+" .score`
  18. echo "$lab $score" >> $summary
  19. make clean > /dev/null
  20. popd > /dev/null
  21. done
  22. echo "Labs with changes detected: " $LABS
  23. echo
  24. echo "============================== Summary =============================="
  25. cat $summary
  26. rm $summary
  27. echo
  28. for lab in $LABS; do
  29. echo "================================ $lab ==============================="
  30. cat $lab/.score
  31. rm $lab/.score
  32. done
  33. exit $failed