stages:
  - test

.pintos_tests:
  stage: test
  image: gitlab.doc.ic.ac.uk:4567/lab2425_autumn/pintos_22/pintos-testing:latest
  artifacts:
    when: always
    paths:
      - src/$DIR/build/tests/$DIR/
  before_script:
    - cd src/utils
    - make
    - export PATH=$PWD:$PATH
    - cd ../..
  script:
    - cd src/$DIR
    - make check | tee build.log
    - grep -q "FAIL tests/$DIR" build.log && exit 1 || exit 0

test_devices:
  extends: .pintos_tests
  variables:
    DIR: devices

test_filesys:
  extends: .pintos_tests
  variables:
    DIR: filesys

test_threads:
  extends: .pintos_tests
  variables:
    DIR: threads

test_userprog:
  extends: .pintos_tests
  variables:
    DIR: userprog

test_vm:
  extends: .pintos_tests
  variables:
    DIR: vm
