EhevuTov
EhevuTov

Reputation: 20463

Automatic testing of server and client using `make`?

What is an example of a way to run a test against a server? In other words, how would you run a server and then run a test client against the server from a make file? For example, I want to run make test which will run all tests against the server to verify it's passing all tests. I know how to run a test for a single program, say against a library, but not how to run two programs that are dependent for the test, at once.

Upvotes: 0

Views: 226

Answers (1)

Maxim Egorushkin
Maxim Egorushkin

Reputation: 136208

It is more convenient to have a shell script that spawns multiple processes and orchestrates them because each line of a makefile recipe is a new invocation of the shell. Use make to invoke that test shell script that would do something like:

  1. Start the server in the background.
  2. Start the client.
  3. Run tests.
  4. Terminate the client.
  5. Terminate the server.
  6. Return the process return code indicating test success or failure.

Upvotes: 1

Related Questions