Hans Leidekker : pdh: Add tests for opening and closing queries.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Jul 9 10:24:59 CDT 2007


Module: wine
Branch: master
Commit: 0a6f6874afc88fa4582f513b3c5ea8c9448fe8b1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0a6f6874afc88fa4582f513b3c5ea8c9448fe8b1

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Sun Jul  8 14:06:08 2007 +0200

pdh: Add tests for opening and closing queries.

---

 .gitignore                    |    5 ++++
 Makefile.in                   |    2 +
 configure                     |    3 ++
 configure.ac                  |    1 +
 dlls/Makefile.in              |    5 ++++
 dlls/pdh/Makefile.in          |    1 +
 dlls/pdh/tests/Makefile.in    |   13 ++++++++++
 dlls/pdh/tests/pdh.c          |   54 +++++++++++++++++++++++++++++++++++++++++
 programs/winetest/Makefile.in |    3 ++
 programs/winetest/winetest.rc |    1 +
 10 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7c7ccff..2aba4ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -431,6 +431,10 @@ dlls/olesvr.dll16
 dlls/olesvr32/libolesvr32.def
 dlls/opengl32/libopengl32.def
 dlls/opengl32/version.res
+dlls/pdh/libpdh.def
+dlls/pdh/tests/*.ok
+dlls/pdh/tests/pdh_crosstest.exe
+dlls/pdh/tests/testlist.c
 dlls/powrprof/libpowrprof.def
 dlls/printui/printui.res
 dlls/psapi/libpsapi.def
@@ -883,6 +887,7 @@ programs/winetest/ntprint_test.exe
 programs/winetest/odbccp32_test.exe
 programs/winetest/ole32_test.exe
 programs/winetest/oleaut32_test.exe
+programs/winetest/pdh_test.exe
 programs/winetest/psapi_test.exe
 programs/winetest/quartz_test.exe
 programs/winetest/riched20_test.exe
diff --git a/Makefile.in b/Makefile.in
index 1963967..e416465 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -332,6 +332,7 @@ ALL_MAKEFILES = \
 	dlls/olesvr32/Makefile \
 	dlls/opengl32/Makefile \
 	dlls/pdh/Makefile \
+	dlls/pdh/tests/Makefile \
 	dlls/powrprof/Makefile \
 	dlls/printui/Makefile \
 	dlls/psapi/Makefile \
@@ -690,6 +691,7 @@ dlls/olepro32/Makefile: dlls/olepro32/Makefile.in dlls/Makedll.rules
 dlls/olesvr32/Makefile: dlls/olesvr32/Makefile.in dlls/Makedll.rules
 dlls/opengl32/Makefile: dlls/opengl32/Makefile.in dlls/Makedll.rules
 dlls/pdh/Makefile: dlls/pdh/Makefile.in dlls/Makedll.rules
+dlls/pdh/tests/Makefile: dlls/pdh/tests/Makefile.in dlls/Maketest.rules
 dlls/powrprof/Makefile: dlls/powrprof/Makefile.in dlls/Makedll.rules
 dlls/printui/Makefile: dlls/printui/Makefile.in dlls/Makedll.rules
 dlls/psapi/Makefile: dlls/psapi/Makefile.in dlls/Makedll.rules
diff --git a/configure b/configure
index 47240f5..3a9a625 100755
--- a/configure
+++ b/configure
@@ -20471,6 +20471,8 @@ ac_config_files="$ac_config_files dlls/opengl32/Makefile"
 
 ac_config_files="$ac_config_files dlls/pdh/Makefile"
 
+ac_config_files="$ac_config_files dlls/pdh/tests/Makefile"
+
 ac_config_files="$ac_config_files dlls/powrprof/Makefile"
 
 ac_config_files="$ac_config_files dlls/printui/Makefile"
@@ -21549,6 +21551,7 @@ do
     "dlls/olesvr32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/olesvr32/Makefile" ;;
     "dlls/opengl32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/opengl32/Makefile" ;;
     "dlls/pdh/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/pdh/Makefile" ;;
+    "dlls/pdh/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/pdh/tests/Makefile" ;;
     "dlls/powrprof/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/powrprof/Makefile" ;;
     "dlls/printui/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/printui/Makefile" ;;
     "dlls/psapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/psapi/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 01165a0..885bdcc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1661,6 +1661,7 @@ AC_CONFIG_FILES([dlls/olepro32/Makefile])
 AC_CONFIG_FILES([dlls/olesvr32/Makefile])
 AC_CONFIG_FILES([dlls/opengl32/Makefile])
 AC_CONFIG_FILES([dlls/pdh/Makefile])
+AC_CONFIG_FILES([dlls/pdh/tests/Makefile])
 AC_CONFIG_FILES([dlls/powrprof/Makefile])
 AC_CONFIG_FILES([dlls/printui/Makefile])
 AC_CONFIG_FILES([dlls/psapi/Makefile])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 56412cf..9cc2ec7 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -274,6 +274,7 @@ TESTSUBDIRS = \
 	odbccp32/tests \
 	ole32/tests \
 	oleaut32/tests \
+	pdh/tests \
 	psapi/tests \
 	quartz/tests \
 	riched20/tests \
@@ -550,6 +551,7 @@ IMPORT_LIBS = \
 	olepro32/libolepro32.$(IMPLIBEXT) \
 	olesvr32/libolesvr32.$(IMPLIBEXT) \
 	opengl32/libopengl32.$(IMPLIBEXT) \
+	pdh/libpdh.$(IMPLIBEXT) \
 	powrprof/libpowrprof.$(IMPLIBEXT) \
 	psapi/libpsapi.$(IMPLIBEXT) \
 	quartz/libquartz.$(IMPLIBEXT) \
@@ -840,6 +842,9 @@ olesvr32/libolesvr32.$(IMPLIBEXT): olesvr32/olesvr32.spec $(WINEBUILD)
 opengl32/libopengl32.$(IMPLIBEXT): opengl32/opengl32.spec $(WINEBUILD)
 	@cd opengl32 && $(MAKE) libopengl32.$(IMPLIBEXT)
 
+pdh/libpdh.$(IMPLIBEXT): pdh/pdh.spec $(WINEBUILD)
+	@cd pdh && $(MAKE) libpdh.$(IMPLIBEXT)
+
 powrprof/libpowrprof.$(IMPLIBEXT): powrprof/powrprof.spec $(WINEBUILD)
 	@cd powrprof && $(MAKE) libpowrprof.$(IMPLIBEXT)
 
diff --git a/dlls/pdh/Makefile.in b/dlls/pdh/Makefile.in
index 38155aa..d9920ea 100644
--- a/dlls/pdh/Makefile.in
+++ b/dlls/pdh/Makefile.in
@@ -3,6 +3,7 @@ TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = pdh.dll
+IMPORTLIB = libpdh.$(IMPLIBEXT)
 IMPORTS   = kernel32
 
 C_SRCS = \
diff --git a/dlls/pdh/tests/Makefile.in b/dlls/pdh/tests/Makefile.in
new file mode 100644
index 0000000..9f89dff
--- /dev/null
+++ b/dlls/pdh/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = pdh.dll
+IMPORTS   = pdh kernel32
+
+CTESTS = \
+	pdh.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/pdh/tests/pdh.c b/dlls/pdh/tests/pdh.c
new file mode 100644
index 0000000..872f2a1
--- /dev/null
+++ b/dlls/pdh/tests/pdh.c
@@ -0,0 +1,54 @@
+/*
+ * Tests for pdh.dll (Performance Data Helper)
+ *
+ * Copyright 2007 Hans Leidekker
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdio.h>
+
+#include "windows.h"
+
+#include "pdh.h"
+#include "pdhmsg.h"
+
+#include "wine/test.h"
+
+static void test_open_close_query( void )
+{
+    PDH_STATUS ret;
+    PDH_HQUERY query;
+
+    ret = PdhOpenQueryA( NULL, 0, NULL );
+    ok(ret == PDH_INVALID_ARGUMENT, "PdhOpenQueryA failed 0x%08x\n", ret);
+
+    ret = PdhOpenQueryA( NULL, 0, &query );
+    ok(ret == ERROR_SUCCESS, "PdhOpenQueryA failed 0x%08x\n", ret);
+
+    ret = PdhCloseQuery( NULL );
+    ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
+
+    ret = PdhCloseQuery( &query );
+    ok(ret == PDH_INVALID_HANDLE, "PdhCloseQuery failed 0x%08x\n", ret);
+
+    ret = PdhCloseQuery( query );
+    ok(ret == ERROR_SUCCESS, "PdhCloseQuery failed 0x%08x\n", ret);
+}
+
+START_TEST(pdh)
+{
+    test_open_close_query();
+}
diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in
index 3b85ea9..f0eeac4 100644
--- a/programs/winetest/Makefile.in
+++ b/programs/winetest/Makefile.in
@@ -64,6 +64,7 @@ TESTBINS = \
 	odbccp32_test.exe \
 	ole32_test.exe \
 	oleaut32_test.exe \
+	pdh_test.exe \
 	psapi_test.exe \
 	quartz_test.exe \
 	riched20_test.exe \
@@ -171,6 +172,8 @@ ole32_test.exe: $(DLLDIR)/ole32/tests/ole32_test.exe$(DLLEXT)
 	cp $(DLLDIR)/ole32/tests/ole32_test.exe$(DLLEXT) $@ && $(STRIP) $@
 oleaut32_test.exe: $(DLLDIR)/oleaut32/tests/oleaut32_test.exe$(DLLEXT)
 	cp $(DLLDIR)/oleaut32/tests/oleaut32_test.exe$(DLLEXT) $@ && $(STRIP) $@
+pdh_test.exe: $(DLLDIR)/pdh/tests/pdh_test.exe$(DLLEXT)
+	cp $(DLLDIR)/pdh/tests/pdh_test.exe$(DLLEXT) $@ && $(STRIP) $@
 psapi_test.exe: $(DLLDIR)/psapi/tests/psapi_test.exe$(DLLEXT)
 	cp $(DLLDIR)/psapi/tests/psapi_test.exe$(DLLEXT) $@ && $(STRIP) $@
 quartz_test.exe: $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT)
diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc
index d6d0c0d..37a9e5c 100644
--- a/programs/winetest/winetest.rc
+++ b/programs/winetest/winetest.rc
@@ -187,6 +187,7 @@ ntprint_test.exe TESTRES "ntprint_test.exe"
 odbccp32_test.exe TESTRES "odbccp32_test.exe"
 ole32_test.exe TESTRES "ole32_test.exe"
 oleaut32_test.exe TESTRES "oleaut32_test.exe"
+pdh_test.exe TESTRES "pdh_test.exe"
 psapi_test.exe TESTRES "psapi_test.exe"
 quartz_test.exe TESTRES "quartz_test.exe"
 riched20_test.exe TESTRES "riched20_test.exe"




More information about the wine-cvs mailing list