Skip to content

test job does not use binaries generated in build job

I have the following jobs set up in a linux runner. buildlinux builds the MyApp Qt application and puts it in the project root dir. buildtestlinux builds a suite of unit tests (that test MyApp in realtime via a local network connection) and also puts it in the project root dir. Then, testlinux should execute the test suite binary built in the previous job. But testlinux fails and says the binary cannot be found (although when running the commands manually it is in the right directory and everything works).

buildlinux:
  type: build
  script:
    - cd prj/MyApp/project && qmake
    - make -j5

buildtestlinux:
  type: build
  script:
    - cd prj/TestApp/project && qmake
    - make -j5

testlinux:
  type: test
  script:
    - ./tst_TestApp

Is it possible that the build output gets cleaned up before the test job? If that is the case, how can I prevent it? If I put the building of all binaries in a before_script and add more test jobs, a lot of time would be wasted re-building MyApp for every test step, and the build steps would basically always build everything twice.