source: src/tests/preempt_longrun/stack.c @ 8f34661

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprno_listpersistent-indexerpthread-emulationqualifiedEnum
Last change on this file since 8f34661 was ef952d7, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Change watchdog tests to output a a frequency smaller than 1Hz

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