tests: fix lcov failures on non-i586 archs 15/199115/1
authorMichal Bloch <m.bloch@samsung.com>
Mon, 4 Feb 2019 11:42:51 +0000 (12:42 +0100)
committerMichal Bloch <m.bloch@samsung.com>
Mon, 4 Feb 2019 11:55:51 +0000 (12:55 +0100)
Change-Id: I15f8d07018bce5e8889b5df2f972046314800d59
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/tests/log_file.c

index cf37dc7..70f7d62 100644 (file)
@@ -48,8 +48,13 @@ char *__wrap_log_buffer_get_tag(const struct logger_entry *entry)
        return "";
 }
 
+static bool custom_memcpy;
+void *__real_memcpy(void *dest, const void *src, size_t n);
 void *__wrap_memcpy(void *dest, const void *src, size_t n)
 {
+       if (!custom_memcpy)
+               return __real_memcpy(dest, src, n);
+
        assert(src == (void *) 0xBA5EBALL);
        assert(n == sizeof(struct logger_entry));
 }
@@ -177,6 +182,7 @@ int main()
        assert(rename_calls == 3);
        assert(open_calls == 2);
 
+       custom_memcpy = true;
        lf.prev_sec = 4444;
        lf.prev_nsec = 6666;
        should_print_line = false;
@@ -198,6 +204,7 @@ int main()
 
        fail_snprintf = false;
        assert(!logfile_write_with_rotation((struct logger_entry *) 0xBA5EBALL, &lf, SORT_SENT_MONO));
+       custom_memcpy = false;
 
        logfile_free(&lf);