GNU/Linux ◆ xterm-256color ◆ bash 1613 views

We have a simple test framework and about 200 test cases. Each test case can be divided into three stages: preparation, testing, checking the results. Each test is a binary file. When a test completes preparation, it is demonized. Then we can do a test action (e.g. dump and restore it). After that we send a signal to stop and check the results. We have shortcuts to execute and stop a test. make test.pid make test.out The framework only contains a few functions: test_init, test_daemon, test_go, test_waitsig, err, pass, fail, test_msg. A test framework must help developers write tests. Another part of our test system is a bash script zdtm.sh. This script executes tests, does test actions and checks the results. CRUI allows to dump/restore, creates iterative snapshots, works with a page server, etc. All these are called test actions here. zdtm.sh does preparation for a test if it’s required. For example, it constructs a minimal root to execute tests in another mount namespace. zdtm.sh allows to execute tests concurrently. For that it executes each test in a new pid namespace. zdtm.sh does basic checks. For example, it checks if  processes are restored with the same set of file descriptors and memory mappings. Each developer must execute the “make tests” command before sending patches. It executes dump/restore for all tests and other test actions within one test. It’s running less then three minutes.