On Wed, Mar 19, 2014 at 04:52:32PM +0100, Ján Tomko wrote: > Parse iscsiadm output with and without the recently introduced > flashnode info. [1] > > This should check that commits like 57e17a7 (fixing [2]) do > not break iscsiadm output parsing. > > [1] https://github.com/mikechristie/open-iscsi/commit/181af9a > [2] https://bugzilla.redhat.com/show_bug.cgi?id=1067173 > --- > tests/Makefile.am | 6 +++ > tests/viriscsitest.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 143 insertions(+) > create mode 100644 tests/viriscsitest.c > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 90f70ff..a1a89ab 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -141,6 +141,7 @@ test_programs = virshtest sockettest \ > virendiantest \ > virfiletest \ > viridentitytest \ > + viriscsitest \ > virkeycodetest \ > virlockspacetest \ > virlogtest \ > @@ -643,6 +644,7 @@ storagevolxml2argvtest_SOURCES = \ > testutils.c testutils.h > storagevolxml2argvtest_LDADD = \ > ../src/libvirt_driver_storage_impl.la $(LDADDS) > + > else ! WITH_STORAGE > EXTRA_DIST += storagevolxml2argvtest.c > endif ! WITH_STORAGE > @@ -787,6 +789,10 @@ viridentitytest_DEPENDENCIES = libsecurityselinuxhelper.la \ > ../src/libvirt.la > endif WITH_SELINUX > > +viriscsitest_SOURCES = \ > + viriscsitest.c testutils.h testutils.c > +viriscsitest_LDADD = $(LDADDS) > + > virkeycodetest_SOURCES = \ > virkeycodetest.c testutils.h testutils.c > virkeycodetest_LDADD = $(LDADDS) > diff --git a/tests/viriscsitest.c b/tests/viriscsitest.c > new file mode 100644 > index 0000000..0b09834 > --- /dev/null > +++ b/tests/viriscsitest.c > @@ -0,0 +1,137 @@ > +/* > + * Copyright (C) 2014 Red Hat, Inc. > + * > + * This library 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. > + * > + * This library 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 library. If not, see > + * <http://www.gnu.org/licenses/>. > + * > + * Author: Jan Tomko <jtomko@xxxxxxxxxx> > + */ > + > +#include <config.h> > + > +#ifdef WIN32 > +int > +main(void) > +{ > + return EXIT_AM_SKIP; > +} > +#else > +# define __VIR_COMMAND_PRIV_H_ALLOW__ > + > +# include "testutils.h" > +# include "vircommandpriv.h" > +# include "viriscsi.h" > + > +# define VIR_FROM_THIS VIR_FROM_NONE > + > +static const char *iscsiadmSessionOutput = > +"tcp: [1] 10.20.30.40:3260,1 iqn.2004-06.example:example1:iscsi.test\n" > +"tcp: [2] 10.20.30.41:3260,1 iqn.2005-05.example:example1:iscsi.hello\n" > +"tcp: [3] 10.20.30.42:3260,1 iqn.2006-04.example:example1:iscsi.world\n" > +"tcp: [5] 10.20.30.43:3260,1 iqn.2007-04.example:example1:iscsi.foo\n" > +"tcp: [6] 10.20.30.44:3260,1 iqn.2008-04.example:example1:iscsi.bar\n" > +"tcp: [7] 10.20.30.45:3260,1 iqn.2009-04.example:example1:iscsi.seven\n"; > + > +static const char *iscsiadmSessionOutputNonFlash = > +"tcp: [1] 10.20.30.40:3260,1 iqn.2004-06.example:example1:iscsi.test (non-flash)\n" > +"tcp: [2] 10.20.30.41:3260,1 iqn.2005-05.example:example1:iscsi.hello (non-flash)\n" > +"tcp: [3] 10.20.30.42:3260,1 iqn.2006-04.example:example1:iscsi.world (non-flash)\n" > +"tcp: [5] 10.20.30.43:3260,1 iqn.2007-04.example:example1:iscsi.foo (non-flash)\n" > +"tcp: [6] 10.20.30.44:3260,1 iqn.2008-04.example:example1:iscsi.bar (non-flash)\n" > +"tcp: [7] 10.20.30.45:3260,1 iqn.2009-04.example:example1:iscsi.seven (non-flash)\n"; I've got a minor preference for the strings to be indented relative to the variable declaration ACK with the whitespace change. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list