mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[test_runner] Add test_runner program
This change introduces test_runner, which runs unit or integration tests
and then tells the kernel to exit QEMU with a status code indicating the
number of failed tests.
The test_runner program is not loaded by default. Use the test manifest
to enable it:
./configure --manifest=assets/manifests/test.yml
A number of tests from the old src/tests have moved over. More to come,
as well as moving code from testapp before getting rid of it.
The test.sh script has been repurposed to be a "headless" version of
qemu.sh for running tests, and it exits with the appropriate exit code.
(Though ./qemu.sh gained the ability to exit with the correct exit code
as well.) Exit codes from kernel panics have been updated so that the
bash scripts should exit with code 127.
This commit is contained in:
30
src/user/test_runner/test_rng.h
Normal file
30
src/user/test_runner/test_rng.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
/// \file test_rng.h
|
||||
/// Simple xorshift-based psuedorandom number generator for tests
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace test {
|
||||
|
||||
class rng
|
||||
{
|
||||
public:
|
||||
using result_type = uint64_t;
|
||||
|
||||
rng(uint64_t seed = 1) : a(seed) {}
|
||||
|
||||
uint64_t operator()() {
|
||||
a ^= a << 13;
|
||||
a ^= a >> 7;
|
||||
a ^= a << 17;
|
||||
return a;
|
||||
}
|
||||
|
||||
constexpr static uint64_t max() { return UINT64_MAX; }
|
||||
constexpr static uint64_t min() { return 0; }
|
||||
|
||||
private:
|
||||
uint64_t a;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
Reference in New Issue
Block a user