source: src/tests/preempt_longrun/stack.c @ d35e796

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