Whamcloud - gitweb
LU-1606 api: compile and build lustreapi test
authorRichard Henwood <richard.henwood@intel.com>
Fri, 26 Apr 2013 15:39:09 +0000 (10:39 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 1 May 2013 16:19:54 +0000 (12:19 -0400)
To avoid regression of the client api conf-sanity includes a new test
73 to verify the lustreapi can be compiled and linked against. All the
files in the directory $LUSTRE_TESTS_API_DIR with the extension .c are
compiled and linked. The directory is located in the build tree at
./lustre/tests/clientapi.

Signed-off-by: Richard Henwood <richard.henwood@intel.com>
Change-Id: I0ad6a1671bf7033ec2ad5bc7a82d82e468cd31c2
Reviewed-on: http://review.whamcloud.com/3440
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/Makefile.am
lustre/tests/clientapi/simple_test.c [new file with mode: 0644]
lustre/tests/conf-sanity.sh

index 11a22c2..d6db98a 100644 (file)
@@ -44,6 +44,7 @@ nobase_noinst_SCRIPTS += racer/file_link.sh racer/file_rename.sh racer/file_syml
 nobase_noinst_SCRIPTS += racer/dir_remote.sh
 nobase_noinst_SCRIPTS += rmtacl/make-tree rmtacl/run
 nobase_noinst_SCRIPTS += posix/posix.cfg
+nobase_noinst_SCRIPTS += clientapi/simple_test.c
 nobase_noinst_DATA = acl/cp.test acl/getfacl-noacl.test acl/inheritance.test
 nobase_noinst_DATA += acl/misc.test acl/permissions.test acl/setfacl.test
 nobase_noinst_DATA += rmtacl/misc.test rmtacl/permissions.test
diff --git a/lustre/tests/clientapi/simple_test.c b/lustre/tests/clientapi/simple_test.c
new file mode 100644 (file)
index 0000000..1205632
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ *  GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program 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
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+
+/* Copyright (c) 2012 Intel Corporporation. All rights reserved.
+ * Use is subject to license terms. */
+
+/* A simple program to test the headers and libraray are
+ *  available.
+ */
+
+#include <lustre/lustreapi.h>
+
+int main(int argc, char *argv[])
+{
+       struct lov_user_md lum;
+
+       return llapi_file_get_stripe(argv[1], &lum);
+}
index 12deabb..ae77611 100644 (file)
@@ -49,6 +49,7 @@ PTLDEBUG=${PTLDEBUG:--1}
 SAVE_PWD=$PWD
 LUSTRE=${LUSTRE:-`dirname $0`/..}
 RLUSTRE=${RLUSTRE:-$LUSTRE}
+LUSTRE_TESTS_API_DIR=${LUSTRE_TESTS_API_DIR:-${LUSTRE}/tests/clientapi}
 export MULTIOP=${MULTIOP:-multiop}
 
 . $LUSTRE/tests/test-framework.sh
@@ -4006,6 +4007,17 @@ test_73() { #LU-3006
 }
 run_test 73 "failnode to update from mountdata properly"
 
+test_74() { # LU-1606
+       for TESTPROG in $LUSTRE_TESTS_API_DIR/*.c; do
+               gcc -Wall -Werror $LUSTRE_TESTS_API_DIR/simple_test.c \
+                       -I$LUSTRE/include \
+                       -L$LUSTRE/utils -llustreapi ||
+                               error "client api broken"
+       done
+       cleanup || return $?
+}
+run_test 74 "Lustre client api program can compile and link"
+
 if ! combined_mgs_mds ; then
        stop mgs
 fi