return 0;
}
+int syslog_test_setup(struct unit_test_state *uts)
+{
+ ut_assertok(log_device_set_enable(LOG_GET_DRIVER(syslog), true));
+
+ return 0;
+}
+
+int syslog_test_finish(struct unit_test_state *uts)
+{
+ ut_assertok(log_device_set_enable(LOG_GET_DRIVER(syslog), false));
+
+ return 0;
+}
+
/**
* log_test_syslog_err() - test log_err() function
*
int old_log_level = gd->default_log_level;
struct sb_log_env env;
+ ut_assertok(syslog_test_setup(uts));
gd->log_fmt = LOGF_TEST;
gd->default_log_level = LOGL_INFO;
env_set("ethact", "eth@10002000");
sandbox_eth_set_tx_handler(0, NULL);
gd->default_log_level = old_log_level;
gd->log_fmt = log_get_default_format();
+ ut_assertok(syslog_test_finish(uts));
return 0;
}
int old_log_level = gd->default_log_level;
struct sb_log_env env;
+ ut_assertok(syslog_test_setup(uts));
gd->log_fmt = LOGF_TEST;
gd->default_log_level = LOGL_INFO;
env_set("ethact", "eth@10002000");
ut_assertnull(env.expected);
gd->default_log_level = old_log_level;
gd->log_fmt = log_get_default_format();
+ ut_assertok(syslog_test_finish(uts));
return 0;
}
int old_log_level = gd->default_log_level;
struct sb_log_env env;
+ ut_assertok(syslog_test_setup(uts));
gd->log_fmt = LOGF_TEST;
gd->default_log_level = LOGL_INFO;
env_set("ethact", "eth@10002000");
ut_assertnull(env.expected);
gd->default_log_level = old_log_level;
gd->log_fmt = log_get_default_format();
+ ut_assertok(syslog_test_finish(uts));
return 0;
}
int old_log_level = gd->default_log_level;
struct sb_log_env env;
+ ut_assertok(syslog_test_setup(uts));
gd->log_fmt = LOGF_TEST;
gd->default_log_level = LOGL_INFO;
env_set("ethact", "eth@10002000");
ut_assertnull(env.expected);
gd->default_log_level = old_log_level;
gd->log_fmt = log_get_default_format();
+ ut_assertok(syslog_test_finish(uts));
return 0;
}
int old_log_level = gd->default_log_level;
struct sb_log_env env;
+ ut_assertok(syslog_test_setup(uts));
gd->log_fmt = LOGF_TEST;
gd->default_log_level = LOGL_DEBUG;
env_set("ethact", "eth@10002000");
ut_assertnull(env.expected);
gd->default_log_level = old_log_level;
gd->log_fmt = log_get_default_format();
+ ut_assertok(syslog_test_finish(uts));
return 0;
}
*/
int sb_log_tx_handler(struct udevice *dev, void *packet, unsigned int len);
+/**
+ * syslog_test_setup() - Enable syslog logging ready for tests
+ *
+ * @uts: Test state
+ * @return 0 if OK, -ENOENT if the syslog log driver is not found
+ */
+int syslog_test_setup(struct unit_test_state *uts);
+
+/**
+ * syslog_test_finish() - Disable syslog logging after tests
+ *
+ * @uts: Test state
+ * @return 0 if OK, -ENOENT if the syslog log driver is not found
+ */
+int syslog_test_finish(struct unit_test_state *uts);
+
#endif