0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include <stdio.h>
0027 #include <stdlib.h>
0028 #include <unistd.h>
0029 #include <sys/time.h>
0030 #include <sys/timex.h>
0031 #include <time.h>
0032 #include <sys/types.h>
0033 #include <sys/stat.h>
0034 #include <fcntl.h>
0035 #include <string.h>
0036 #include <sys/wait.h>
0037 #include "../kselftest.h"
0038
0039 #define NSEC_PER_SEC 1000000000LL
0040
0041 int main(int argc, char **argv)
0042 {
0043 struct timex tx;
0044 int ret, ppm;
0045 pid_t pid;
0046
0047
0048 printf("Running Asynchronous Frequency Changing Tests...\n");
0049
0050 pid = fork();
0051 if (!pid)
0052 return system("./inconsistency-check -c 1 -t 600");
0053
0054 ppm = 500;
0055 ret = 0;
0056
0057 while (pid != waitpid(pid, &ret, WNOHANG)) {
0058 ppm = -ppm;
0059 tx.modes = ADJ_FREQUENCY;
0060 tx.freq = ppm << 16;
0061 adjtimex(&tx);
0062 usleep(500000);
0063 }
0064
0065
0066 tx.modes = ADJ_FREQUENCY;
0067 tx.offset = 0;
0068 adjtimex(&tx);
0069
0070
0071 if (ret) {
0072 printf("[FAILED]\n");
0073 return ksft_exit_fail();
0074 }
0075 printf("[OK]\n");
0076 return ksft_exit_pass();
0077 }