/* test-umockdev-record.c generated by valac 0.18.1, the Vala compiler
 * generated from test-umockdev-record.vala, do not modify */

/*
 * test-umockdev-record.vala
 *
 * Copyright (C) 2013 Canonical Ltd.
 * Author: Martin Pitt <martin.pitt@ubuntu.com>
 *
 * umockdev is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * umockdev is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; If not, see <http://www.gnu.org/licenses/>.
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <umockdev.h>
#include <glib/gstdio.h>

#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);


extern gchar* umockdev_record_path;
gchar* umockdev_record_path = NULL;

void t_testbed_all_empty (void);
void t_testbed_one (void);
void t_testbed_multiple (void);
void t_testbed_no_ioctl_record (void);
void t_system_all (void);
void t_system_ioctl_log (void);
gint _vala_main (gchar** args, int args_length1);
static void _t_testbed_all_empty_gcallback (void);
static void _t_testbed_one_gcallback (void);
static void _t_testbed_multiple_gcallback (void);
static void _t_testbed_no_ioctl_record_gcallback (void);
static void _t_system_all_gcallback (void);
static void _t_system_ioctl_log_gcallback (void);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);


void t_testbed_all_empty (void) {
	gchar* sout = NULL;
	gchar* serr = NULL;
	gint exit = 0;
	UMockdevTestbed* _tmp0_;
	UMockdevTestbed* tb;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_ = NULL;
	gint _tmp6_ = 0;
	GError * _inner_error_ = NULL;
	_tmp0_ = umockdev_testbed_new ();
	tb = _tmp0_;
	_vala_assert (tb != NULL, "tb != null");
	_tmp1_ = umockdev_record_path;
	_tmp2_ = g_strconcat (_tmp1_, " --all", NULL);
	_tmp3_ = _tmp2_;
	g_spawn_command_line_sync (_tmp3_, &_tmp4_, &_tmp5_, &_tmp6_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp4_;
	_g_free0 (serr);
	serr = _tmp5_;
	exit = _tmp6_;
	_g_free0 (_tmp3_);
	if (_inner_error_ != NULL) {
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	g_assert_cmpstr (serr, ==, "");
	g_assert_cmpstr (sout, ==, "");
	g_assert_cmpint (exit, ==, 0);
	_g_object_unref0 (tb);
	_g_free0 (serr);
	_g_free0 (sout);
}


void t_testbed_one (void) {
	gchar* sout = NULL;
	gchar* serr = NULL;
	gint exit = 0;
	UMockdevTestbed* _tmp0_;
	UMockdevTestbed* tb;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar** _tmp5_ = NULL;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar** _tmp9_ = NULL;
	gchar** _tmp10_;
	gint _tmp10__length1;
	gchar* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* syspath;
	guint8* _tmp13_ = NULL;
	guint8* _tmp14_;
	gint _tmp14__length1;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_ = NULL;
	gchar* _tmp19_ = NULL;
	gint _tmp20_ = 0;
	GError * _inner_error_ = NULL;
	_tmp0_ = umockdev_testbed_new ();
	tb = _tmp0_;
	_tmp1_ = g_strdup ("simple_attr");
	_tmp2_ = g_strdup ("1");
	_tmp3_ = g_strdup ("multiline_attr");
	_tmp4_ = g_strdup ("a\\b\nc\\d\nlast");
	_tmp5_ = g_new0 (gchar*, 4 + 1);
	_tmp5_[0] = _tmp1_;
	_tmp5_[1] = _tmp2_;
	_tmp5_[2] = _tmp3_;
	_tmp5_[3] = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 4;
	_tmp7_ = g_strdup ("SIMPLE_PROP");
	_tmp8_ = g_strdup ("1");
	_tmp9_ = g_new0 (gchar*, 2 + 1);
	_tmp9_[0] = _tmp7_;
	_tmp9_[1] = _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp10__length1 = 2;
	_tmp11_ = umockdev_testbed_add_devicev (tb, "pci", "dev1", NULL, _tmp6_, _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp10_ = (_vala_array_free (_tmp10_, _tmp10__length1, (GDestroyNotify) g_free), NULL);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
	syspath = _tmp12_;
	_tmp13_ = g_new0 (guint8, 6);
	_tmp13_[0] = (guint8) 0x41;
	_tmp13_[1] = (guint8) 0xFF;
	_tmp13_[2] = (guint8) 0;
	_tmp13_[3] = (guint8) 5;
	_tmp13_[4] = (guint8) 0xFF;
	_tmp13_[5] = (guint8) 0;
	_tmp14_ = _tmp13_;
	_tmp14__length1 = 6;
	umockdev_testbed_set_attribute_binary (tb, syspath, "binary_attr", _tmp14_, 6);
	_tmp14_ = (g_free (_tmp14_), NULL);
	_tmp15_ = umockdev_record_path;
	_tmp16_ = g_strconcat (_tmp15_, " --all", NULL);
	_tmp17_ = _tmp16_;
	g_spawn_command_line_sync (_tmp17_, &_tmp18_, &_tmp19_, &_tmp20_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp18_;
	_g_free0 (serr);
	serr = _tmp19_;
	exit = _tmp20_;
	_g_free0 (_tmp17_);
	if (_inner_error_ != NULL) {
		_g_free0 (syspath);
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	g_assert_cmpstr (serr, ==, "");
	g_assert_cmpint (exit, ==, 0);
	g_assert_cmpstr (sout, ==, "P: /devices/dev1\n" \
"E: SIMPLE_PROP=1\n" \
"E: SUBSYSTEM=pci\n" \
"H: binary_attr=41FF0005FF00\n" \
"A: multiline_attr=a\\\\b\\nc\\\\d\\nlast\n" \
"A: simple_attr=1\n" \
"\n");
	_g_free0 (syspath);
	_g_object_unref0 (tb);
	_g_free0 (serr);
	_g_free0 (sout);
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = needle;
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
	result = _tmp1_ != NULL;
	return result;
}


void t_testbed_multiple (void) {
	gchar* sout = NULL;
	gchar* serr = NULL;
	gint exit = 0;
	UMockdevTestbed* _tmp0_;
	UMockdevTestbed* tb;
	UMockdevTestbed* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar** _tmp4_ = NULL;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar** _tmp8_ = NULL;
	gchar** _tmp9_;
	gint _tmp9__length1;
	gchar* _tmp10_ = NULL;
	gchar* _tmp11_;
	gchar* dev1;
	UMockdevTestbed* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gchar** _tmp16_ = NULL;
	gchar** _tmp17_;
	gint _tmp17__length1;
	gchar* _tmp18_;
	gchar* _tmp19_;
	gchar** _tmp20_ = NULL;
	gchar** _tmp21_;
	gint _tmp21__length1;
	gchar* _tmp22_ = NULL;
	gchar* _tmp23_;
	gchar* subdev1;
	UMockdevTestbed* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar** _tmp27_ = NULL;
	gchar** _tmp28_;
	gint _tmp28__length1;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar** _tmp31_ = NULL;
	gchar** _tmp32_;
	gint _tmp32__length1;
	gchar* _tmp33_ = NULL;
	gchar* _tmp34_;
	const gchar* _tmp35_;
	gchar* _tmp36_;
	gchar* _tmp37_;
	const gchar* _tmp38_;
	gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_ = NULL;
	gchar* _tmp42_ = NULL;
	gint _tmp43_ = 0;
	const gchar* _tmp44_;
	gint _tmp45_;
	const gchar* _tmp46_;
	const gchar* _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	const gchar* _tmp50_;
	gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* _tmp53_ = NULL;
	gchar* _tmp54_ = NULL;
	gint _tmp55_ = 0;
	const gchar* _tmp56_;
	gint _tmp57_;
	const gchar* _tmp58_;
	const gchar* _tmp59_;
	gchar* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_ = NULL;
	gchar* _tmp63_ = NULL;
	gint _tmp64_ = 0;
	const gchar* _tmp65_;
	gint _tmp66_;
	const gchar* _tmp67_;
	gboolean _tmp68_ = FALSE;
	const gchar* _tmp69_;
	gboolean _tmp70_ = FALSE;
	const gchar* _tmp71_;
	gboolean _tmp72_ = FALSE;
	GError * _inner_error_ = NULL;
	_tmp0_ = umockdev_testbed_new ();
	tb = _tmp0_;
	_tmp1_ = tb;
	_tmp2_ = g_strdup ("dev1color");
	_tmp3_ = g_strdup ("green");
	_tmp4_ = g_new0 (gchar*, 2 + 1);
	_tmp4_[0] = _tmp2_;
	_tmp4_[1] = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp5__length1 = 2;
	_tmp6_ = g_strdup ("DEV1COLOR");
	_tmp7_ = g_strdup ("GREEN");
	_tmp8_ = g_new0 (gchar*, 2 + 1);
	_tmp8_[0] = _tmp6_;
	_tmp8_[1] = _tmp7_;
	_tmp9_ = _tmp8_;
	_tmp9__length1 = 2;
	_tmp10_ = umockdev_testbed_add_devicev (_tmp1_, "pci", "dev1", NULL, _tmp5_, _tmp9_);
	_tmp11_ = _tmp10_;
	_tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL);
	_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
	dev1 = _tmp11_;
	_tmp12_ = tb;
	_tmp13_ = dev1;
	_tmp14_ = g_strdup ("subdev1color");
	_tmp15_ = g_strdup ("yellow");
	_tmp16_ = g_new0 (gchar*, 2 + 1);
	_tmp16_[0] = _tmp14_;
	_tmp16_[1] = _tmp15_;
	_tmp17_ = _tmp16_;
	_tmp17__length1 = 2;
	_tmp18_ = g_strdup ("SUBDEV1COLOR");
	_tmp19_ = g_strdup ("YELLOW");
	_tmp20_ = g_new0 (gchar*, 2 + 1);
	_tmp20_[0] = _tmp18_;
	_tmp20_[1] = _tmp19_;
	_tmp21_ = _tmp20_;
	_tmp21__length1 = 2;
	_tmp22_ = umockdev_testbed_add_devicev (_tmp12_, "pci", "subdev1", _tmp13_, _tmp17_, _tmp21_);
	_tmp23_ = _tmp22_;
	_tmp21_ = (_vala_array_free (_tmp21_, _tmp21__length1, (GDestroyNotify) g_free), NULL);
	_tmp17_ = (_vala_array_free (_tmp17_, _tmp17__length1, (GDestroyNotify) g_free), NULL);
	subdev1 = _tmp23_;
	_tmp24_ = tb;
	_tmp25_ = g_strdup ("dev2color");
	_tmp26_ = g_strdup ("brown");
	_tmp27_ = g_new0 (gchar*, 2 + 1);
	_tmp27_[0] = _tmp25_;
	_tmp27_[1] = _tmp26_;
	_tmp28_ = _tmp27_;
	_tmp28__length1 = 2;
	_tmp29_ = g_strdup ("DEV2COLOR");
	_tmp30_ = g_strdup ("BROWN");
	_tmp31_ = g_new0 (gchar*, 2 + 1);
	_tmp31_[0] = _tmp29_;
	_tmp31_[1] = _tmp30_;
	_tmp32_ = _tmp31_;
	_tmp32__length1 = 2;
	_tmp33_ = umockdev_testbed_add_devicev (_tmp24_, "pci", "dev2", NULL, _tmp28_, _tmp32_);
	_tmp34_ = _tmp33_;
	_g_free0 (_tmp34_);
	_tmp32_ = (_vala_array_free (_tmp32_, _tmp32__length1, (GDestroyNotify) g_free), NULL);
	_tmp28_ = (_vala_array_free (_tmp28_, _tmp28__length1, (GDestroyNotify) g_free), NULL);
	_tmp35_ = umockdev_record_path;
	_tmp36_ = g_strconcat (_tmp35_, " ", NULL);
	_tmp37_ = _tmp36_;
	_tmp38_ = subdev1;
	_tmp39_ = g_strconcat (_tmp37_, _tmp38_, NULL);
	_tmp40_ = _tmp39_;
	g_spawn_command_line_sync (_tmp40_, &_tmp41_, &_tmp42_, &_tmp43_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp41_;
	_g_free0 (serr);
	serr = _tmp42_;
	exit = _tmp43_;
	_g_free0 (_tmp40_);
	_g_free0 (_tmp37_);
	if (_inner_error_ != NULL) {
		_g_free0 (subdev1);
		_g_free0 (dev1);
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp44_ = serr;
	g_assert_cmpstr (_tmp44_, ==, "");
	_tmp45_ = exit;
	g_assert_cmpint (_tmp45_, ==, 0);
	_tmp46_ = sout;
	g_assert_cmpstr (_tmp46_, ==, "P: /devices/dev1/subdev1\n" \
"E: SUBDEV1COLOR=YELLOW\n" \
"E: SUBSYSTEM=pci\n" \
"A: subdev1color=yellow\n" \
"\n" \
"P: /devices/dev1\n" \
"E: DEV1COLOR=GREEN\n" \
"E: SUBSYSTEM=pci\n" \
"A: dev1color=green\n" \
"\n");
	_tmp47_ = umockdev_record_path;
	_tmp48_ = g_strconcat (_tmp47_, " ", NULL);
	_tmp49_ = _tmp48_;
	_tmp50_ = dev1;
	_tmp51_ = g_strconcat (_tmp49_, _tmp50_, NULL);
	_tmp52_ = _tmp51_;
	g_spawn_command_line_sync (_tmp52_, &_tmp53_, &_tmp54_, &_tmp55_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp53_;
	_g_free0 (serr);
	serr = _tmp54_;
	exit = _tmp55_;
	_g_free0 (_tmp52_);
	_g_free0 (_tmp49_);
	if (_inner_error_ != NULL) {
		_g_free0 (subdev1);
		_g_free0 (dev1);
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp56_ = serr;
	g_assert_cmpstr (_tmp56_, ==, "");
	_tmp57_ = exit;
	g_assert_cmpint (_tmp57_, ==, 0);
	_tmp58_ = sout;
	g_assert_cmpstr (_tmp58_, ==, "P: /devices/dev1\n" \
"E: DEV1COLOR=GREEN\n" \
"E: SUBSYSTEM=pci\n" \
"A: dev1color=green\n" \
"\n");
	_tmp59_ = umockdev_record_path;
	_tmp60_ = g_strconcat (_tmp59_, " --all", NULL);
	_tmp61_ = _tmp60_;
	g_spawn_command_line_sync (_tmp61_, &_tmp62_, &_tmp63_, &_tmp64_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp62_;
	_g_free0 (serr);
	serr = _tmp63_;
	exit = _tmp64_;
	_g_free0 (_tmp61_);
	if (_inner_error_ != NULL) {
		_g_free0 (subdev1);
		_g_free0 (dev1);
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp65_ = serr;
	g_assert_cmpstr (_tmp65_, ==, "");
	_tmp66_ = exit;
	g_assert_cmpint (_tmp66_, ==, 0);
	_tmp67_ = sout;
	_tmp68_ = string_contains (_tmp67_, "P: /devices/dev1/subdev1\n");
	_vala_assert (_tmp68_, "sout.contains (\"P: /devices/dev1/subdev1\\n\")");
	_tmp69_ = sout;
	_tmp70_ = string_contains (_tmp69_, "P: /devices/dev1\n");
	_vala_assert (_tmp70_, "sout.contains (\"P: /devices/dev1\\n\")");
	_tmp71_ = sout;
	_tmp72_ = string_contains (_tmp71_, "P: /devices/dev2\n");
	_vala_assert (_tmp72_, "sout.contains (\"P: /devices/dev2\\n\")");
	_g_free0 (subdev1);
	_g_free0 (dev1);
	_g_object_unref0 (tb);
	_g_free0 (serr);
	_g_free0 (sout);
}


void t_testbed_no_ioctl_record (void) {
	gchar* sout = NULL;
	gchar* serr = NULL;
	gint exit = 0;
	UMockdevTestbed* _tmp0_;
	UMockdevTestbed* tb;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar** _tmp5_ = NULL;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_ = NULL;
	gint _tmp14_ = 0;
	gboolean _tmp15_ = FALSE;
	GError * _inner_error_ = NULL;
	_tmp0_ = umockdev_testbed_new ();
	tb = _tmp0_;
	_tmp1_ = g_strdup ("dev");
	_tmp2_ = g_strdup ("1:5");
	_tmp3_ = g_new0 (gchar*, 2 + 1);
	_tmp3_[0] = _tmp1_;
	_tmp3_[1] = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp4__length1 = 2;
	_tmp5_ = g_new0 (gchar*, 0 + 1);
	_tmp6_ = _tmp5_;
	_tmp6__length1 = 0;
	_tmp7_ = umockdev_testbed_add_devicev (tb, "mem", "zero", NULL, _tmp4_, _tmp6_);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp8_);
	_tmp6_ = (_vala_array_free (_tmp6_, _tmp6__length1, (GDestroyNotify) g_free), NULL);
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
	_tmp9_ = umockdev_record_path;
	_tmp10_ = g_strconcat (_tmp9_, " --ioctl /dev/stdout /sys/devices/zero -- head -c1 /dev/zero", NULL);
	_tmp11_ = _tmp10_;
	g_spawn_command_line_sync (_tmp11_, &_tmp12_, &_tmp13_, &_tmp14_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp12_;
	_g_free0 (serr);
	serr = _tmp13_;
	exit = _tmp14_;
	_g_free0 (_tmp11_);
	if (_inner_error_ != NULL) {
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	g_assert_cmpint (exit, !=, 0);
	g_assert_cmpstr (sout, ==, "");
	_tmp15_ = string_contains (serr, "UMOCKDEV_DIR cannot be used");
	_vala_assert (_tmp15_, "serr.contains (\"UMOCKDEV_DIR cannot be used\")");
	_g_object_unref0 (tb);
	_g_free0 (serr);
	_g_free0 (sout);
}


void t_system_all (void) {
	gchar* sout = NULL;
	gchar* serr = NULL;
	gint exit = 0;
	const gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	gint _tmp5_ = 0;
	const gchar* _tmp6_;
	gint _tmp7_;
	const gchar* _tmp8_;
	gboolean _tmp9_ = FALSE;
	const gchar* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	UMockdevTestbed* _tmp13_;
	UMockdevTestbed* tb;
	UMockdevTestbed* _tmp14_;
	const gchar* _tmp15_;
	gboolean _tmp16_ = FALSE;
	gboolean _tmp17_;
	GError * _inner_error_ = NULL;
	_tmp0_ = umockdev_record_path;
	_tmp1_ = g_strconcat (_tmp0_, " --all", NULL);
	_tmp2_ = _tmp1_;
	g_spawn_command_line_sync (_tmp2_, &_tmp3_, &_tmp4_, &_tmp5_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp3_;
	_g_free0 (serr);
	serr = _tmp4_;
	exit = _tmp5_;
	_g_free0 (_tmp2_);
	if (_inner_error_ != NULL) {
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp6_ = serr;
	g_assert_cmpstr (_tmp6_, ==, "");
	_tmp7_ = exit;
	g_assert_cmpint (_tmp7_, ==, 0);
	_tmp8_ = sout;
	_tmp9_ = g_str_has_prefix (_tmp8_, "P:");
	_vala_assert (_tmp9_, "sout.has_prefix (\"P:\")");
	_tmp10_ = sout;
	_tmp11_ = strlen (_tmp10_);
	_tmp12_ = _tmp11_;
	g_assert_cmpint (_tmp12_, >=, 100);
	_tmp13_ = umockdev_testbed_new ();
	tb = _tmp13_;
	_tmp14_ = tb;
	_tmp15_ = sout;
	_tmp16_ = umockdev_testbed_add_from_string (_tmp14_, _tmp15_, &_inner_error_);
	_tmp17_ = _tmp16_;
	if (_inner_error_ != NULL) {
		_g_object_unref0 (tb);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_vala_assert (_tmp17_, "tb.add_from_string (sout)");
	_g_object_unref0 (tb);
	_g_free0 (serr);
	_g_free0 (sout);
}


void t_system_ioctl_log (void) {
	gchar* sout = NULL;
	gchar* serr = NULL;
	gint exit = 0;
	gchar* _tmp0_ = NULL;
	gchar* workdir;
	const gchar* _tmp1_;
	gchar* _tmp2_ = NULL;
	gchar* log;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_ = NULL;
	gchar* _tmp12_ = NULL;
	gint _tmp13_ = 0;
	const gchar* _tmp14_;
	gint _tmp15_;
	const gchar* _tmp16_;
	const gchar* _tmp17_;
	gboolean _tmp18_ = FALSE;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_ = NULL;
	gchar* _tmp28_ = NULL;
	gint _tmp29_ = 0;
	const gchar* _tmp30_;
	gint _tmp31_;
	const gchar* _tmp32_;
	const gchar* _tmp33_;
	gboolean _tmp34_ = FALSE;
	gchar* contents = NULL;
	const gchar* _tmp35_;
	gchar* _tmp36_ = NULL;
	const gchar* _tmp37_;
	GError * _inner_error_ = NULL;
	_tmp0_ = g_dir_make_tmp ("ioctl_log_test.XXXXXX", &_inner_error_);
	workdir = _tmp0_;
	if (_inner_error_ != NULL) {
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp1_ = workdir;
	_tmp2_ = g_build_filename (_tmp1_, "log", NULL);
	log = _tmp2_;
	_tmp3_ = umockdev_record_path;
	_tmp4_ = g_strconcat (_tmp3_, " --ioctl ", NULL);
	_tmp5_ = _tmp4_;
	_tmp6_ = log;
	_tmp7_ = g_strconcat (_tmp5_, _tmp6_, NULL);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strconcat (_tmp8_, " /dev/null -- head -c1 /dev/zero", NULL);
	_tmp10_ = _tmp9_;
	g_spawn_command_line_sync (_tmp10_, &_tmp11_, &_tmp12_, &_tmp13_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp11_;
	_g_free0 (serr);
	serr = _tmp12_;
	exit = _tmp13_;
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	_g_free0 (_tmp5_);
	if (_inner_error_ != NULL) {
		_g_free0 (log);
		_g_free0 (workdir);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp14_ = serr;
	g_assert_cmpstr (_tmp14_, ==, "");
	_tmp15_ = exit;
	g_assert_cmpint (_tmp15_, ==, 0);
	_tmp16_ = sout;
	g_assert_cmpstr (_tmp16_, ==, "\0");
	_tmp17_ = log;
	_tmp18_ = g_file_test (_tmp17_, G_FILE_TEST_EXISTS);
	_vala_assert (!_tmp18_, "!FileUtils.test (log, FileTest.EXISTS)");
	_tmp19_ = umockdev_record_path;
	_tmp20_ = g_strconcat (_tmp19_, " --ioctl ", NULL);
	_tmp21_ = _tmp20_;
	_tmp22_ = log;
	_tmp23_ = g_strconcat (_tmp21_, _tmp22_, NULL);
	_tmp24_ = _tmp23_;
	_tmp25_ = g_strconcat (_tmp24_, " /dev/zero -- head -c1 /dev/zero", NULL);
	_tmp26_ = _tmp25_;
	g_spawn_command_line_sync (_tmp26_, &_tmp27_, &_tmp28_, &_tmp29_, &_inner_error_);
	_g_free0 (sout);
	sout = _tmp27_;
	_g_free0 (serr);
	serr = _tmp28_;
	exit = _tmp29_;
	_g_free0 (_tmp26_);
	_g_free0 (_tmp24_);
	_g_free0 (_tmp21_);
	if (_inner_error_ != NULL) {
		_g_free0 (log);
		_g_free0 (workdir);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp30_ = serr;
	g_assert_cmpstr (_tmp30_, ==, "");
	_tmp31_ = exit;
	g_assert_cmpint (_tmp31_, ==, 0);
	_tmp32_ = sout;
	g_assert_cmpstr (_tmp32_, ==, "\0");
	_tmp33_ = log;
	_tmp34_ = g_file_test (_tmp33_, G_FILE_TEST_EXISTS);
	_vala_assert (_tmp34_, "FileUtils.test (log, FileTest.EXISTS)");
	_tmp35_ = log;
	g_file_get_contents (_tmp35_, &_tmp36_, NULL, &_inner_error_);
	_g_free0 (contents);
	contents = _tmp36_;
	if (_inner_error_ != NULL) {
		_g_free0 (contents);
		_g_free0 (log);
		_g_free0 (workdir);
		_g_free0 (serr);
		_g_free0 (sout);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp37_ = contents;
	g_assert_cmpstr (_tmp37_, ==, "");
	_g_free0 (contents);
	_g_free0 (log);
	_g_free0 (workdir);
	_g_free0 (serr);
	_g_free0 (sout);
}


static void _t_testbed_all_empty_gcallback (void) {
	t_testbed_all_empty ();
}


static void _t_testbed_one_gcallback (void) {
	t_testbed_one ();
}


static void _t_testbed_multiple_gcallback (void) {
	t_testbed_multiple ();
}


static void _t_testbed_no_ioctl_record_gcallback (void) {
	t_testbed_no_ioctl_record ();
}


static void _t_system_all_gcallback (void) {
	t_system_all ();
}


static void _t_system_ioctl_log_gcallback (void) {
	t_system_ioctl_log ();
}


gint _vala_main (gchar** args, int args_length1) {
	gint result = 0;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar* rootdir;
	const gchar* _tmp2_;
	const gchar* _tmp12_;
	gchar* _tmp13_ = NULL;
	gint _tmp14_ = 0;
	g_test_init (&args_length1, &args, NULL);
	_tmp0_ = g_getenv ("TOP_BUILDDIR");
	_tmp1_ = g_strdup (_tmp0_);
	rootdir = _tmp1_;
	_tmp2_ = rootdir;
	if (_tmp2_ == NULL) {
		gchar** _tmp3_;
		gint _tmp3__length1;
		const gchar* _tmp4_;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_;
		gchar* _tmp7_ = NULL;
		gchar* _tmp8_;
		gchar* _tmp9_ = NULL;
		gchar* _tmp10_;
		gchar* _tmp11_ = NULL;
		_tmp3_ = args;
		_tmp3__length1 = args_length1;
		_tmp4_ = _tmp3_[0];
		_tmp5_ = realpath (_tmp4_, NULL);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_path_get_dirname (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_path_get_dirname (_tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_path_get_dirname (_tmp10_);
		_g_free0 (rootdir);
		rootdir = _tmp11_;
		_g_free0 (_tmp10_);
		_g_free0 (_tmp8_);
		_g_free0 (_tmp6_);
	}
	_tmp12_ = rootdir;
	_tmp13_ = g_build_filename (_tmp12_, "src", "umockdev-record", NULL);
	_g_free0 (umockdev_record_path);
	umockdev_record_path = _tmp13_;
	g_test_add_func ("/umockdev-record/testbed-all-empty", _t_testbed_all_empty_gcallback);
	g_test_add_func ("/umockdev-record/testbed-one", _t_testbed_one_gcallback);
	g_test_add_func ("/umockdev-record/testbed-multiple", _t_testbed_multiple_gcallback);
	g_test_add_func ("/umockdev-record/testbed-no-ioctl-record", _t_testbed_no_ioctl_record_gcallback);
	g_test_add_func ("/umockdev-record/system-all", _t_system_all_gcallback);
	g_test_add_func ("/umockdev-record/ioctl-log", _t_system_ioctl_log_gcallback);
	_tmp14_ = g_test_run ();
	result = _tmp14_;
	_g_free0 (rootdir);
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return _vala_main (argv, argc);
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}



