strace/tests/utime.c
Dmitry V. Levin f14a8e1665 tests: convert several tests from match_grep to match_diff
* tests/sendfile.test: Use match_diff instead of match_grep.
* tests/sendfile64.test: Likewise.
* tests/time.test: Likewise.
* tests/utime.test: Likewise.
* tests/xet_robust_list.test: Likewise.
* tests/sendfile.c (main): Update match patterns for match_diff.
* tests/sendfile64.c (main): Likewise.
* tests/time.c (main): Likewise.
* tests/utime.c (main): Likewise.
* tests/xet_robust_list.c (main): Likewise.
2015-08-27 00:09:46 +00:00

30 lines
623 B
C

#include <time.h>
#include <utime.h>
#include <errno.h>
#include <stdio.h>
static void
print_tm(struct tm *p)
{
printf("%02d/%02d/%02d-%02d:%02d:%02d",
p->tm_year + 1900, p->tm_mon + 1, p->tm_mday,
p->tm_hour, p->tm_min, p->tm_sec);
}
int
main(void)
{
time_t t = time(NULL);
struct utimbuf u = { .actime = t, .modtime = t };
struct tm *p = localtime(&t);
printf("utime(\"utime\\nfilename\", [");
print_tm(p);
printf(", ");
print_tm(p);
puts("]) = -1 ENOENT (No such file or directory)");
puts("+++ exited with 0 +++");
return utime("utime\nfilename", &u) == -1 && errno == ENOENT ? 0 : 77;
}