#include <stdlib.h>
#include <errno.h>
#include <string.h>
+
#include "lxc/state.h"
+#include "lxctest.h"
#define MYNAME "lxctest1"
exit(EXIT_FAILURE);
}
+ /* EXPECT SUCCESS: lxc.syslog with valid value. */
+ if (!c->set_config_item(c, "lxc.syslog", "local0")) {
+ lxc_error("%s\n", "Failed to set lxc.syslog.\n");
+ goto out;
+ }
+ ret = c->get_config_item(c, "lxc.syslog", v2, 255);
+ if (ret < 0) {
+ lxc_error("Failed to retrieve lxc.syslog: %d.\n", ret);
+ goto out;
+ }
+ if (strcmp(v2, "local0") != 0) {
+ lxc_error("Expected: local0 == %s.\n", v2);
+ goto out;
+ }
+ lxc_debug("Retrieving value for lxc.syslog correctly returned: %s.\n", v2);
+
+ /* EXPECT FAILURE: lxc.syslog with invalid value. */
+ if (c->set_config_item(c, "lxc.syslog", "NONSENSE")) {
+ lxc_error("%s\n", "Succeeded int setting lxc.syslog to invalid value \"NONSENSE\".\n");
+ goto out;
+ }
+ lxc_debug("%s\n", "Successfully failed to set lxc.syslog to invalid value.\n");
+
if (!c->set_config_item(c, "lxc.hook.pre-start", "hi there")) {
fprintf(stderr, "%d: failed to set hook.pre-start\n", __LINE__);
goto out;
#include <stdio.h>
#include <stdlib.h>
+#define lxc_debug_stream(stream, format, ...) \
+ do { \
+ fprintf(stream, "%s: %d: %s: " format, __FILE__, __LINE__, \
+ __func__, __VA_ARGS__); \
+ } while (false)
+
+#define lxc_error(format, ...) lxc_debug_stream(stderr, format, __VA_ARGS__)
+#define lxc_debug(format, ...) lxc_debug_stream(stdout, format, __VA_ARGS__)
+
#define lxc_test_assert_stringify(expression, stringify_expression) \
do { \
if (!(expression)) { \