[[ "$line" == "rawformatTEST" ]] && ok || fail
LOG_DETAILS="testing if KMSG works in the default format"
-# We check if the command returns at least 1000 logs. This seems to be a safe value. In my test,
-# my target reaches it in about 2 seconds after the boot. Feel free to change it to a reasonable
-# yet lower value if the test happens to fail otherwise, but it would be extremely surprising.
-[[ "$(dlogutil -db kmsg | wc -l)" -gt 1000 ]] && ok || fail
+# We check if the command returns at least 100 logs. This seems to be a safe value.
+# Feel free to change it to a reasonable yet lower value if the test happens to fail otherwise.
+[[ "$(dlogutil -db kmsg | wc -l)" -gt 100 ]] && ok || fail
LOG_DETAILS="testing if KMSG works in the raw format"
last_dmesg=`dmesg | tail -n1 | sed -re "s/^\[[ 0-9]{5,}\.[0-9]{6}\] (.*)$/\1/g"`
int ret;
};
+bool compare_suffix(const char* string, const char *suffix)
+{
+ int add = (int)strlen(string) - strlen(suffix);
+ return add >= 0 && strcmp(string + add, suffix) == 0;
+}
+
int test_callback(const dlogutil_entry_s *ent, void *var)
{
struct test_data *data = var;
switch (prio) {
case DLOG_ERROR:
- if (strcmp(msg, "test_libdlog.c: main(61) > test data, level: error"))
+ if (!compare_suffix(msg, "test data, level: error"))
return -EINVAL;
data->errors += 1;
break;
case DLOG_INFO:
- if (strcmp(msg, "test_libdlog.c: main(63) > test data, level: info"))
+ if (!compare_suffix(msg, "test data, level: info"))
return -EINVAL;
data->infos += 1;
break;