summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
authordufour2010-07-08 07:58:10 +0000
committerdufour2010-07-08 07:58:10 +0000
commit3c92d686b9db5dc415108394bc2b93ba798bad6a (patch)
treee033e879219a86dfcc5c7e5ae211b39c09f309e0 /cesar
parent60881787dd04273ac90aa9b9c5e2d4f1d8147629 (diff)
cesar/lib/stats: in DRV_SET_CONFIG, failed when writing non existing stat
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7285 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar')
-rw-r--r--cesar/lib/src/stats.c4
-rw-r--r--cesar/lib/test/stats/src/test_stats.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/cesar/lib/src/stats.c b/cesar/lib/src/stats.c
index 6d49408ccf..969534d492 100644
--- a/cesar/lib/src/stats.c
+++ b/cesar/lib/src/stats.c
@@ -556,7 +556,9 @@ lib_stats_write_stats (const char *stats)
*value = '\0';
value++;
/* Write statistic. */
- lib_stats_write_stat (name, value);
+ if (!lib_stats_write_stat (name, value))
+ /* Stat does not exist, error. */
+ return false;
}
else
/* Error, stop here. */
diff --git a/cesar/lib/test/stats/src/test_stats.c b/cesar/lib/test/stats/src/test_stats.c
index 6d070cacf2..4bf84e2033 100644
--- a/cesar/lib/test/stats/src/test_stats.c
+++ b/cesar/lib/test/stats/src/test_stats.c
@@ -728,6 +728,13 @@ stats_access_mode_test_case (test_t t)
test_fail_if (value_u64 != 0x4242424242424242ull);
test_fail_if (value_u32 != 0x01234567ul);
+ /* Non existing stats should failed. */
+ test_fail_if (lib_stats_write_stats ("non_existing:0x01") != false);
+ /* Stats should not have changed. */
+ test_fail_if (value_u8 != 0x42);
+ test_fail_if (value_u64 != 0x4242424242424242ull);
+ test_fail_if (value_u32 != 0x01234567ul);
+
} test_end;
/* Clean. */