summaryrefslogtreecommitdiffstats
path: root/ini/ini_parse_ut.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2013-01-26 20:07:48 -0500
committerOndrej Kos <okos@redhat.com>2013-01-28 12:03:23 +0100
commit44174288111e9715ccbb96e8a8283e99a721ba7b (patch)
tree7500bc62bf91247f50039765542bffeec4baf1af /ini/ini_parse_ut.c
parent059519fb2a8d056eba5f61cde98ed8b5292195d4 (diff)
downloadding-libs-44174288111e9715ccbb96e8a8283e99a721ba7b.tar.gz
ding-libs-44174288111e9715ccbb96e8a8283e99a721ba7b.tar.xz
ding-libs-44174288111e9715ccbb96e8a8283e99a721ba7b.zip
Expose collected stat data
Added a new top level interface funtion and a unit test for it.
Diffstat (limited to 'ini/ini_parse_ut.c')
-rw-r--r--ini/ini_parse_ut.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c
index c5e9166..32c59e7 100644
--- a/ini/ini_parse_ut.c
+++ b/ini/ini_parse_ut.c
@@ -1057,6 +1057,7 @@ int startup_test(void)
char command[PATH_MAX * 3];
char *srcdir = NULL;
char *builddir;
+ const struct stat *file_stat;
INIOUT(printf("<==== Startup test ====>\n"));
@@ -1095,6 +1096,12 @@ int startup_test(void)
return error;
}
+ file_stat = ini_config_get_stat(file_ctx);
+ if (file_stat) {
+ printf("Expected NULL got not NULL!\n");
+ return EINVAL;
+ }
+
/* We will check just permissions here. */
error = ini_config_access_check(file_ctx,
INI_ACCESS_CHECK_MODE, /* add uid & gui flags
@@ -1125,6 +1132,16 @@ int startup_test(void)
return error;
}
+ /* Get stats */
+ file_stat = ini_config_get_stat(file_ctx);
+ if (!file_stat) {
+ printf("Expected not NULL got NULL!\n");
+ return EINVAL;
+ }
+
+ INIOUT(printf("File was modified at: %d seconds since Jan 1 1970.\n",
+ (int)(file_stat->st_mtime)));
+
/* We will check just permissions here. */
error = ini_config_access_check(file_ctx,
INI_ACCESS_CHECK_MODE, /* add uid & gui flags