Usage:
Python:
lsmenv sim ./test/test_vpd.py 600508b1001c79ade5178f0626caaa9c
or if you prefer the install way:
./test/test_vpd.py 600508b1001c79ade5178f0626caaa9c
C:
make test/test_vpd83 && test/test_vpd83 600508b1001c79ade5178f0626caaa9c
Signed-off-by: Gris Ge <[email protected]>
---
test/Makefile.am | 5 +++++
test/test_vpd83.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
test/test_vpd83.py | 10 ++++++++++
3 files changed, 63 insertions(+)
create mode 100644 test/test_vpd83.c
create mode 100755 test/test_vpd83.py
diff --git a/test/Makefile.am b/test/Makefile.am
index 872e8e0..4b591e4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -11,3 +11,8 @@ check_PROGRAMS = tester
tester_CFLAGS = $(LIBCHECK_CFLAGS)
tester_LDADD = ../c_binding/libstoragemgmt.la $(LIBCHECK_LIBS)
tester_SOURCES = tester.c
+
+bin_PROGRAMS = test_vpd83
+test_vpd83_CFLAGS = $(LIBCHECK_CFLAGS)
+test_vpd83_LDADD = ../c_binding/libstoragemgmt.la $(LIBCHECK_LIBS)
+test_vpd83_SOURCES = test_vpd83.c
diff --git a/test/test_vpd83.c b/test/test_vpd83.c
new file mode 100644
index 0000000..aa22dc3
--- /dev/null
+++ b/test/test_vpd83.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 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 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: Gris Ge <[email protected]>
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <libstoragemgmt/libstoragemgmt.h>
+
+int main(int argc, char **argv)
+{
+ const char **sd_names= NULL;
+ uint32_t sd_name_count = 0;
+ uint32_t i = 0;
+ int rc = 0;
+
+ if (argc != 2) {
+ printf("Please only define a VPD83 in command line\n");
+ exit(EXIT_FAILURE);
+ }
+
+ rc = lsm_scsi_disk_name_list_of_vpd83(argv[1], &sd_names, &sd_name_count);
+
+ if (sd_names != NULL) {
+ for(; i < sd_name_count; ++i) {
+ printf("got %s\n", sd_names[i]);
+ }
+ lsm_scsi_disk_name_list_free(sd_names, sd_name_count);
+ exit(EXIT_SUCCESS);
+ }
+ printf("not found, error: %d\n", rc);
+ exit(EXIT_FAILURE);
+}
diff --git a/test/test_vpd83.py b/test/test_vpd83.py
new file mode 100755
index 0000000..914d76f
--- /dev/null
+++ b/test/test_vpd83.py
@@ -0,0 +1,10 @@
+#!/usr/bin/python2
+
+import lsm
+import sys
+
+if len(sys.argv) != 2:
+ print "Please specify 1 VPD83 ID"
+ exit()
+
+print lsm.SCSI.disk_name_of_vpd83(sys.argv[1])
--
1.8.3.1
_______________________________________________
libstoragemgmt-devel mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/libstoragemgmt-devel