Testing log configuration generation.

-- Testcase --
{%
	let real_include = include;

	include("./cfg/ucentral.uc", {
		TRACE_CALLS: "stderr",

		/* wrap include() to fixup the include paths */
		include: function(path, scope) {
			path = replace(path, "/usr/share/ucentral/", "../cfg/");

			/* make path absolute */
			if (index(path, "/") != 0) {
				try {
					die();
				} catch(e) {
					path = replace(e.stacktrace[1].filename, /\/[^\/]+$/, '') + '/' + path;
				};
			}

			return real_include(path, scope);
		}
	})
%}
-- End --

-- Environment --
{
	"capab": {},
	"cfg": {
		"log" : {
			"log_hostname" : "foo",
			"log_ip" : "192.168.11.23",
			"log_port" : 12345,
			"log_proto" : "udp",
			"log_size" : 128
		}
	}
}
-- End --

-- File fs/stat~_usr_share_ucentral_cfg_log_uc.json --
{ "type": "file" }
-- End --

-- Expect stderr --
[call] fs.stat path </usr/share/ucentral/cfg_log.uc>
-- End --

-- Expect stdout --
set system.@system[-1].log_size='128'
set system.@system[-1].log_proto='udp'
set system.@system[-1].log_ip='192.168.11.23'
set system.@system[-1].log_port='12345'
set system.@system[-1].log_hostname='foo'
set system.@system[-1].log_remote='1'
-- End --
