1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26#include <stdio.h>
27#include <stdlib.h>
28#include <unistd.h>
29#include <sys/time.h>
30#include <sys/timex.h>
31#include <time.h>
32#include <sys/types.h>
33#include <sys/stat.h>
34#include <fcntl.h>
35#include <string.h>
36#include <sys/wait.h>
37#include "../kselftest.h"
38
39#define NSEC_PER_SEC 1000000000LL
40
41int main(int argv, char **argc)
42{
43 struct timex tx;
44 int ret, ppm;
45 pid_t pid;
46
47
48 printf("Running Asynchronous Frequency Changing Tests...\n");
49
50 pid = fork();
51 if (!pid)
52 return system("./inconsistency-check -c 1 -t 600");
53
54 ppm = 500;
55 ret = 0;
56
57 while (pid != waitpid(pid, &ret, WNOHANG)) {
58 ppm = -ppm;
59 tx.modes = ADJ_FREQUENCY;
60 tx.freq = ppm << 16;
61 adjtimex(&tx);
62 usleep(500000);
63 }
64
65
66 tx.modes = ADJ_FREQUENCY;
67 tx.offset = 0;
68 adjtimex(&tx);
69
70
71 if (ret) {
72 printf("[FAILED]\n");
73 return ksft_exit_fail();
74 }
75 printf("[OK]\n");
76 return ksft_exit_pass();
77}
78