]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
Add winverbs test application framework. Test acquires and releases IWVProvider...
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 4 Mar 2008 07:32:38 +0000 (07:32 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Tue, 4 Mar 2008 07:32:38 +0000 (07:32 +0000)
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1@968 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/winverbs/tests/dirs
branches/winverbs/tests/wvtests/dirs [new file with mode: 0644]
branches/winverbs/tests/wvtests/user/SOURCES [new file with mode: 0644]
branches/winverbs/tests/wvtests/user/makefile [new file with mode: 0644]
branches/winverbs/tests/wvtests/user/wv_main.cpp [new file with mode: 0644]

index fc792b6c44d7c612fddb3d4be0f7b15ada25a998..31cd5c20ebd7f495b4936585fe2fde849c860c02 100644 (file)
@@ -1,6 +1,7 @@
 DIRS=\\r
        alts    \\r
        cmtest  \\r
-       wsd             \\r
+       wsd     \\r
        ibat    \\r
-       limits\r
+       limits  \\r
+       wvtests\r
diff --git a/branches/winverbs/tests/wvtests/dirs b/branches/winverbs/tests/wvtests/dirs
new file mode 100644 (file)
index 0000000..389156f
--- /dev/null
@@ -0,0 +1,2 @@
+DIRS=\\r
+       user\r
diff --git a/branches/winverbs/tests/wvtests/user/SOURCES b/branches/winverbs/tests/wvtests/user/SOURCES
new file mode 100644 (file)
index 0000000..5eedd23
--- /dev/null
@@ -0,0 +1,26 @@
+TARGETNAME=winverb\r
+TARGETPATH=..\..\..\bin\user\obj$(BUILD_ALT_DIR)\r
+TARGETTYPE=PROGRAM\r
+UMTYPE=console\r
+UMENTRY=main\r
+USE_MSVCRT=1\r
+USE_STL=1\r
+\r
+SOURCES=\\r
+       wv_main.cpp\r
+       \r
+INCLUDES=..\..\..\inc;..\..\..\inc\user;\r
+\r
+TARGETLIBS= \\r
+       $(SDK_LIB_PATH)\kernel32.lib    \\r
+       $(SDK_LIB_PATH)\advapi32.lib    \\r
+       $(SDK_LIB_PATH)\user32.lib      \\r
+       $(SDK_LIB_PATH)\ole32.lib       \\r
+!if $(FREEBUILD)\r
+       $(TARGETPATH)\*\winverbs.lib\r
+!else\r
+       $(TARGETPATH)\*\winverbsd.lib\r
+!endif\r
+\r
+USER_C_FLAGS=$(USER_C_FLAGS) /EHsc\r
+MSC_WARNING_LEVEL= /W3\r
diff --git a/branches/winverbs/tests/wvtests/user/makefile b/branches/winverbs/tests/wvtests/user/makefile
new file mode 100644 (file)
index 0000000..bffacaa
--- /dev/null
@@ -0,0 +1,7 @@
+#\r
+# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source\r
+# file to this component.  This file merely indirects to the real make file\r
+# that is shared by all the driver components of the OpenIB Windows project.\r
+#\r
+\r
+!INCLUDE ..\..\..\inc\openib.def\r
diff --git a/branches/winverbs/tests/wvtests/user/wv_main.cpp b/branches/winverbs/tests/wvtests/user/wv_main.cpp
new file mode 100644 (file)
index 0000000..de84d96
--- /dev/null
@@ -0,0 +1,101 @@
+/*\r
+ * Copyright (c) 2008 Intel Corporation. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ *     Redistribution and use in source and binary forms, with or\r
+ *     without modification, are permitted provided that the following\r
+ *     conditions are met:\r
+ *\r
+ *      - Redistributions of source code must retain the above\r
+ *        copyright notice, this list of conditions and the following\r
+ *        disclaimer.\r
+ *\r
+ *      - Redistributions in binary form must reproduce the above\r
+ *        copyright notice, this list of conditions and the following\r
+ *        disclaimer in the documentation and/or other materials\r
+ *        provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AWV\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ */\r
+\r
+#include <iostream>\r
+\r
+#include <rdma\winverbs.h>\r
+\r
+static void ShowProviderOptions()\r
+{\r
+       std::cout << "provider options" << std::endl;\r
+       std::cout << "\t" << "--help" << std::endl;\r
+       std::cout << "\t\t" << "display this message" << std::endl;\r
+}\r
+\r
+static int ProviderTest(int argc, char *argv[])\r
+{\r
+       IWVProvider *prov;\r
+       HRESULT hr;\r
+       ULONG ref;\r
+\r
+       if (argc > 2)\r
+       {\r
+               ShowProviderOptions();\r
+               return 0;\r
+       }\r
+\r
+       std::cout << "Validating IWVProvider interface" << std::endl;\r
+\r
+       hr = WvGetObject(IID_IWVProvider, (LPVOID*) &prov);\r
+       if (hr != NOERROR)\r
+       {\r
+               std::cout << "Error WvGetObject: " << hr << std::endl;\r
+               return hr;\r
+       }\r
+\r
+       ref = prov->AddRef();\r
+       if (ref != 2)\r
+               std::cout << "Error AddRef: " << ref << std::endl;\r
+\r
+       prov->Release();\r
+       prov->Release();\r
+\r
+       std::cout << "Success" << std::endl;\r
+       return hr;\r
+}\r
+\r
+static void ShowUsage()\r
+{\r
+       std::cout << "winverb <interface> [options]" << std::endl;\r
+       std::cout << "<interface> is one of the following:" << std::endl;\r
+       std::cout << "\t" << "provider" << std::endl;\r
+       std::cout << std::endl;\r
+       std::cout << "Type 'winverb <interface> --help' for option details" << std::endl;\r
+}\r
+\r
+int __cdecl main(int argc, char *argv[])\r
+{\r
+       if (argc < 2)\r
+       {\r
+               ShowUsage();\r
+               return E_INVALIDARG;\r
+       }\r
+\r
+       if (!strcmp("provider", argv[1]))\r
+       {\r
+               return ProviderTest(argc, argv);\r
+       }\r
+       else\r
+       {\r
+               ShowUsage();\r
+               return E_INVALIDARG;\r
+       }\r
+\r
+       return 0;\r
+}\r