Commit 2319f12d authored by Ari Trachtenberg's avatar Ari Trachtenberg
Browse files

added benchmark

parent aee6a598
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ stages:
  - prebuild
  - compile
  - test
  - efficiency

include:
  - local: 'ci_cd/problem2.yml'
+49 −0
Original line number Diff line number Diff line
@@ -51,3 +51,52 @@ exec_problem_2:
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem2"'
  tags: [c++-17]

benchmark:
  stage: efficiency
  needs:
    - job: exec_problem_2
      artifacts: true
  script:
    - git clone https://trachten-gitlab:${HW_INTERNAL}@agile.bu.edu/gitlab/ec330/ec330_staff/homeworks_internal/hw4_ec.git hw4_ec
    - cp include/MyBloom.h hw4_ec/include/
    # don't fail if MyBloom.cpp does not exist
    - |
      if [ -f impl/MyBloom.cpp ]; then
        cp impl/MyBloom.cpp hw4_ec/impl/
      fi
    - cd hw4_ec
    - make extra
    - set -o pipefail
    - |
      set +e
      ulimit -v $((10 * 1024 * 1024)) # ~10GB
      timeout 450s stdbuf -oL ./test.pl > extra2.out
      STATUS=$?
      set -e
      
      context="$(tail -n 15 extra2.out | tail -c 300)"
      
      if [ "$STATUS" -eq 255 ]; then
        echo "Context: $context"
        echo "Sorting error or Unmet benchmark"
        exit 1
        fi
      if [ "$STATUS" -eq 124 ]; then
        echo "Timeout!"
        exit 1
        fi
      if [ "$STATUS" -eq 134 ] || [ "$STATUS" -eq 137 ]; then
        echo "Out of memory (status $STATUS) — aborted (134) or killed (137)"
        echo "Context: $context"
        exit 1
        fi
      
      score="$(tail -n 1 extra2.out | tr -d '[:space:]')"
    - echo "$context"
    - curl "https://agile.bu.edu/ec330_scripts/saveScores.pl?key=${MAGIC_KEY}&file=hw4bloom&name=${GITLAB_USER_LOGIN}&score=${score}"
  rules:
    - if: '$CI_COMMIT_REF_NAME == "problem2"'
  timeout: 10m
  # tags: [c++-17-light]
  tags: [c++-17]
 No newline at end of file