--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+#include <boost/test/results_reporter.hpp>
+
+#include <log/alog.h>
+
+#include "macros.h"
+
+namespace {
+
+void requireConfigurableLevel(int level, const char* name) {
+ setenv("ASKUSER_LOG_LEVEL", name, true);
+ init_agent_log();
+ BOOST_REQUIRE(__alog_level == level);
+}
+
+}
+
+BOOST_AUTO_TEST_SUITE(TESTS_ASKUSER_COMMON_LOG)
+
+POSITIVE_TEST_CASE(askuser_common_log_config)
+{
+ requireConfigurableLevel(LOG_EMERG, "LOG_EMERG");
+ requireConfigurableLevel(LOG_ALERT, "LOG_ALERT");
+ requireConfigurableLevel(LOG_CRIT, "LOG_CRIT");
+ requireConfigurableLevel(LOG_ERR, "LOG_ERR");
+ requireConfigurableLevel(LOG_WARNING, "LOG_WARNING");
+ requireConfigurableLevel(LOG_NOTICE, "LOG_NOTICE");
+ requireConfigurableLevel(LOG_INFO, "LOG_INFO");
+ requireConfigurableLevel(LOG_DEBUG, "LOG_DEBUG");
+}
+
+NEGATIVE_TEST_CASE(askuser_common_log_config_invalid)
+{
+ requireConfigurableLevel(LOG_ERR, "SOME_INVALID_VALUE");
+}
+
+NEGATIVE_TEST_CASE(askuser_common_log_config_missing)
+{
+ unsetenv("ASKUSER_LOG_LEVEL");
+ init_agent_log();
+ BOOST_REQUIRE(__alog_level == LOG_ERR);
+}
+
+BOOST_AUTO_TEST_SUITE_END()