Branch Coverage

ulib/clock.c
Criterion Covered Total %
branch 44 66 66.6


line true false branch
49 11 9 if (pathlen.path)
52 8 12 if (state_fd >= 0)
78 79 392 if (state_fd == -3) {
80 76 3 if (lstat(pathlen.path, &statbuf) < 0) { /* this covers EINTR too.. ugh */
81 8 68 if (errno == ENOENT)
86 1 2 else if ((statbuf.st_mode & S_IFMT) == S_IFLNK) {
92 0 2 if (state_fd < 0 && errno == ENOENT)
0 0 if (state_fd < 0 && errno == ENOENT)
94 2 0 else if (state_fd >= 0) {
97 2 0 if ((lstat(pathlen.path, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) != S_IFLNK))
2 0 if ((lstat(pathlen.path, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) != S_IFLNK))
100 0 2 if (!state_f) {
110 2 469 if (state_fd >= 0) {
117 1 1 if (fscanf(state_f, "clock: %04x tv: %lu %lu adj: %d\n", &cl, &tv1, &tv2, &a) == 4) {
130 73 398 if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
73 0 if ((last.tv_sec == 0) && (last.tv_usec == 0)) {
138 471 0 if ((tv.tv_sec < last.tv_sec) || ((tv.tv_sec == last.tv_sec) && (tv.tv_usec < last.tv_usec))) {
398 73 if ((tv.tv_sec < last.tv_sec) || ((tv.tv_sec == last.tv_sec) && (tv.tv_usec < last.tv_usec))) {
0 398 if ((tv.tv_sec < last.tv_sec) || ((tv.tv_sec == last.tv_sec) && (tv.tv_usec < last.tv_usec))) {
143 398 73 else if ((tv.tv_sec == last.tv_sec) && (tv.tv_usec == last.tv_usec)) {
0 398 else if ((tv.tv_sec == last.tv_sec) && (tv.tv_usec == last.tv_usec)) {
144 0 0 if (adjustment >= MAX_ADJUSTMENT) {
161 470 1 if ((clock_reg - prev_clock_reg) >= defer_100ns) {
162 7 463 if (state_fd == -1) { /* can create */
164 0 7 if ((lstat(pathlen.path, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) == S_IFLNK))
0 0 if ((lstat(pathlen.path, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) == S_IFLNK))
170 0 7 if (state_fd < 0)
173 7 0 if (state_fd >= 0) {
176 7 0 if ((lstat(pathlen.path, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) != S_IFLNK))
7 0 if ((lstat(pathlen.path, &statbuf) == 0) && ((statbuf.st_mode & S_IFMT) != S_IFLNK))
179 0 7 if (!state_f) {
189 9 461 if (state_fd > 0) {
196 0 9 if (ftruncate(state_fd, len) < 0) {