source: src/tests/preempt_longrun/stack.c @ 7bdcac1

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since 7bdcac1 was 7bdcac1, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Added the option to make longrun tests run until failure

  • Property mode set to 100644
File size: 648 bytes
Line 
1#include <kernel>
2#include <math>
3#include <thread>
4#include <time>
5
6#include "long_tests.h"
7
8#ifndef PREEMPTION_RATE
9#error PREEMPTION_RATE not defined in makefile
10#endif
11
12Duration default_preemption() {
13        return PREEMPTION_RATE;
14}
15
16thread worker_t {};
17
18void main(worker_t & this) {
19        volatile long long p = 5_021_609ul;
20        volatile long long a = 326_417ul;
21        volatile long long n = 1l;
22        for (volatile long long i = 0; TEST(i < p); i++) {
23                n *= a;
24                n %= p;
25                KICK_WATCHDOG;
26        }
27
28        if( !TEST(n == a) ) {
29                abort();
30        }
31}
32
33extern "C" {
34static worker_t * workers;
35}
36
37int main(int argc, char* argv[]) {
38        processor p;
39        {
40                worker_t w[7];
41                workers = w;
42        }
43}
Note: See TracBrowser for help on using the repository browser.