gnome-power-manager r2913 - in trunk: . src test



Author: rhughes
Date: Wed Sep  3 16:33:51 2008
New Revision: 2913
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=2913&view=rev

Log:
2008-09-03  Richard Hughes  <richard hughsie com>

* src/egg-color.c: (egg_st_color):
* src/gpm-array-float.c: (gpm_st_array_float):
* src/gpm-array.c: (gpm_st_array):
* src/gpm-cell-array.c: (gpm_st_cell_array):
* src/gpm-cell-unit.c: (gpm_st_cell_unit):
* src/gpm-cell.c: (gpm_st_cell):
* src/gpm-common.c: (gpm_st_common):
* src/gpm-graph-widget.c: (gpm_st_graph_widget):
* src/gpm-inhibit.c: (gpm_st_inhibit):
* src/gpm-phone.c: (gpm_st_phone):
* src/gpm-profile.c: (gpm_st_profile):
* src/gpm-self-test.c: (gpm_st_start), (gpm_st_end),
(gpm_st_title), (gpm_st_success), (gpm_st_failed),
(gpm_st_warning), (main):
* src/gpm-self-test.h:
* test/gpm-st-hal-device.c: (gpm_st_hal_device):
* test/gpm-st-hal-devicestore.c: (gpm_st_hal_devicestore):
* test/gpm-st-hal-manager.c: (gpm_st_hal_manager):
* test/gpm-st-hal-power.c: (gpm_st_hal_power):
* test/gpm-st-idletime.c: (gpm_st_idletime):
* test/gpm-st-proxy.c: (gpm_st_proxy):
Remove the class type from the self check code, we need to make
all the tests automatic.


Modified:
   trunk/ChangeLog
   trunk/src/egg-color.c
   trunk/src/gpm-array-float.c
   trunk/src/gpm-array.c
   trunk/src/gpm-cell-array.c
   trunk/src/gpm-cell-unit.c
   trunk/src/gpm-cell.c
   trunk/src/gpm-common.c
   trunk/src/gpm-graph-widget.c
   trunk/src/gpm-inhibit.c
   trunk/src/gpm-phone.c
   trunk/src/gpm-profile.c
   trunk/src/gpm-self-test.c
   trunk/src/gpm-self-test.h
   trunk/test/gpm-st-hal-device.c
   trunk/test/gpm-st-hal-devicestore.c
   trunk/test/gpm-st-hal-manager.c
   trunk/test/gpm-st-hal-power.c
   trunk/test/gpm-st-idletime.c
   trunk/test/gpm-st-proxy.c

Modified: trunk/src/egg-color.c
==============================================================================
--- trunk/src/egg-color.c	(original)
+++ trunk/src/egg-color.c	Wed Sep  3 16:33:51 2008
@@ -63,7 +63,7 @@
 	guint8 r, g, b;
 	guint32 colour;
 
-	if (egg_st_start (test, "EggColor", CLASS_AUTO) == FALSE) {
+	if (egg_st_start (test, "EggColor") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-array-float.c
==============================================================================
--- trunk/src/gpm-array-float.c	(original)
+++ trunk/src/gpm-array-float.c	Wed Sep  3 16:33:51 2008
@@ -392,7 +392,7 @@
 	gfloat sigma;
 	guint size;
 
-	if (gpm_st_start (test, "GpmArrayFloat", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmArrayFloat") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-array.c
==============================================================================
--- trunk/src/gpm-array.c	(original)
+++ trunk/src/gpm-array.c	Wed Sep  3 16:33:51 2008
@@ -937,7 +937,7 @@
 	gint svalue;
 	guint i;
 
-	if (gpm_st_start (test, "GpmArray", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmArray") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-cell-array.c
==============================================================================
--- trunk/src/gpm-cell-array.c	(original)
+++ trunk/src/gpm-cell-array.c	Wed Sep  3 16:33:51 2008
@@ -1503,7 +1503,7 @@
 	gboolean ret;
 	guint count;
 
-	if (gpm_st_start (test, "GpmCellArray", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmCellArray") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-cell-unit.c
==============================================================================
--- trunk/src/gpm-cell-unit.c	(original)
+++ trunk/src/gpm-cell-unit.c	Wed Sep  3 16:33:51 2008
@@ -354,7 +354,7 @@
 	const gchar *cvalue;
 	gboolean ret;
 
-	if (gpm_st_start (test, "GpmCellUnit", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmCellUnit") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-cell.c
==============================================================================
--- trunk/src/gpm-cell.c	(original)
+++ trunk/src/gpm-cell.c	Wed Sep  3 16:33:51 2008
@@ -851,7 +851,7 @@
 	gboolean ret;
 	gchar *udi;
 
-	if (gpm_st_start (test, "GpmCell", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmCell") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-common.c
==============================================================================
--- trunk/src/gpm-common.c	(original)
+++ trunk/src/gpm-common.c	Wed Sep  3 16:33:51 2008
@@ -345,7 +345,7 @@
 	guint value;
 	gfloat fvalue;
 
-	if (gpm_st_start (test, "GpmCommon", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmCommon") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-graph-widget.c
==============================================================================
--- trunk/src/gpm-graph-widget.c	(original)
+++ trunk/src/gpm-graph-widget.c	Wed Sep  3 16:33:51 2008
@@ -1398,7 +1398,7 @@
 	GpmArray *events;
 	gboolean ret;
 
-	if (gpm_st_start (test, "GpmGraphWidget", CLASS_MANUAL) == FALSE) {
+	if (gpm_st_start (test, "GpmGraphWidget") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-inhibit.c
==============================================================================
--- trunk/src/gpm-inhibit.c	(original)
+++ trunk/src/gpm-inhibit.c	Wed Sep  3 16:33:51 2008
@@ -625,7 +625,7 @@
 	guint cookie2 = 0;
 	DbusProxy *gproxy;
 
-	if (gpm_st_start (test, "GpmInhibit", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmInhibit") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-phone.c
==============================================================================
--- trunk/src/gpm-phone.c	(original)
+++ trunk/src/gpm-phone.c	Wed Sep  3 16:33:51 2008
@@ -448,7 +448,7 @@
 	guint value;
 	gboolean ret;
 
-	if (gpm_st_start (test, "GpmPhone", CLASS_MANUAL) == FALSE) {
+	if (gpm_st_start (test, "GpmPhone") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-profile.c
==============================================================================
--- trunk/src/gpm-profile.c	(original)
+++ trunk/src/gpm-profile.c	Wed Sep  3 16:33:51 2008
@@ -1014,7 +1014,7 @@
 	guint value;
 	gfloat fvalue;
 
-	if (gpm_st_start (test, "GpmProfile", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "GpmProfile") == FALSE) {
 		return;
 	}
 

Modified: trunk/src/gpm-self-test.c
==============================================================================
--- trunk/src/gpm-self-test.c	(original)
+++ trunk/src/gpm-self-test.c	Wed Sep  3 16:33:51 2008
@@ -30,23 +30,15 @@
 #include "gpm-self-test.h"
 
 gboolean
-gpm_st_start (GpmSelfTest *test, const gchar *name, GpmSelfTestClass class)
+gpm_st_start (GpmSelfTest *test, const gchar *name)
 {
-	if (class == CLASS_AUTO && test->class == CLASS_MANUAL) {
-		return FALSE;
-	}
-	if (class == CLASS_MANUAL && test->class == CLASS_AUTO) {
-		return FALSE;
-	}
 	if (test->started) {
 		g_print ("Not ended test! Cannot start!\n");
 		exit (1);
 	}	
 	test->type = g_strdup (name);
 	test->started = TRUE;
-	if (test->level == LEVEL_NORMAL) {
-		g_print ("%s...", test->type);
-	}
+	g_print ("%s...", test->type);
 	return TRUE;
 }
 
@@ -57,9 +49,7 @@
 		g_print ("Not started test! Cannot finish!\n");
 		exit (1);
 	}	
-	if (test->level == LEVEL_NORMAL) {
-		g_print ("OK\n");
-	}
+	g_print ("OK\n");
 	test->started = FALSE;
 	g_free (test->type);
 }
@@ -69,12 +59,10 @@
 {
 	va_list args;
 	gchar va_args_buffer [1025];
-	if (test->level == LEVEL_ALL) {
-		va_start (args, format);
-		g_vsnprintf (va_args_buffer, 1024, format, args);
-		va_end (args);
-		g_print ("> check #%u\t%s: \t%s...", test->total+1, test->type, va_args_buffer);
-	}
+	va_start (args, format);
+	g_vsnprintf (va_args_buffer, 1024, format, args);
+	va_end (args);
+	g_print ("> check #%u\t%s: \t%s...", test->total+1, test->type, va_args_buffer);
 	test->total++;
 }
 
@@ -83,16 +71,14 @@
 {
 	va_list args;
 	gchar va_args_buffer [1025];
-	if (test->level == LEVEL_ALL) {
-		if (format == NULL) {
-			g_print ("...OK\n");
-			goto finish;
-		}
-		va_start (args, format);
-		g_vsnprintf (va_args_buffer, 1024, format, args);
-		va_end (args);
-		g_print ("...OK [%s]\n", va_args_buffer);
-	}
+	if (format == NULL) {
+		g_print ("...OK\n");
+		goto finish;
+	}
+	va_start (args, format);
+	g_vsnprintf (va_args_buffer, 1024, format, args);
+	va_end (args);
+	g_print ("...OK [%s]\n", va_args_buffer);
 finish:
 	test->succeeded++;
 }
@@ -102,16 +88,14 @@
 {
 	va_list args;
 	gchar va_args_buffer [1025];
-	if (test->level == LEVEL_ALL || test->level == LEVEL_NORMAL) {
-		if (format == NULL) {
-			g_print ("FAILED\n");
-			goto failed;
-		}
-		va_start (args, format);
-		g_vsnprintf (va_args_buffer, 1024, format, args);
-		va_end (args);
-		g_print ("FAILED [%s]\n", va_args_buffer);
-	}
+	if (format == NULL) {
+		g_print ("FAILED\n");
+		goto failed;
+	}
+	va_start (args, format);
+	g_vsnprintf (va_args_buffer, 1024, format, args);
+	va_end (args);
+	g_print ("FAILED [%s]\n", va_args_buffer);
 failed:
 	exit (1);
 }
@@ -121,16 +105,14 @@
 {
 	va_list args;
 	gchar va_args_buffer [1025];
-	if (test->level == LEVEL_ALL || test->level == LEVEL_NORMAL) {
-		if (format == NULL) {
-			g_print ("UNKNOWN WARNING\n");
-			goto out;
-		}
-		va_start (args, format);
-		g_vsnprintf (va_args_buffer, 1024, format, args);
-		va_end (args);
-		g_print ("WARNING [%s]\n", va_args_buffer);
-	}
+	if (format == NULL) {
+		g_print ("UNKNOWN WARNING\n");
+		goto out;
+	}
+	va_start (args, format);
+	g_vsnprintf (va_args_buffer, 1024, format, args);
+	va_end (args);
+	g_print ("WARNING [%s]\n", va_args_buffer);
 out:
 	;
 }
@@ -148,16 +130,12 @@
 	int retval;
 
 	gboolean verbose = FALSE;
-	char *class = NULL;
 	char *level = NULL;
 	char **tests = NULL;
 
 	const GOptionEntry options[] = {
-
 		{ "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose,
 		  "Show verbose debugging information", NULL },
-		{ "class", '\0', 0, G_OPTION_ARG_STRING, &class,
-		  "Debug class, [manual|auto|all]", NULL },
 		{ "level", '\0', 0, G_OPTION_ARG_STRING, &level,
 		  "Set the printing level, [quiet|normal|all]", NULL },
 		{ "tests", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &tests,
@@ -179,34 +157,6 @@
 	test->succeeded = 0;
 	test->type = NULL;
 	test->started = FALSE;
-	test->class = CLASS_AUTO;
-	test->level = LEVEL_ALL;
-
-	if (class != NULL) {
-		if (strcmp (class, "auto") == 0) {
-			test->class = CLASS_AUTO;
-		} else if (strcmp (class, "all") == 0) {
-			test->class = CLASS_ALL;
-		} else if (strcmp (class, "manual") == 0) {
-			test->class = CLASS_MANUAL;
-		} else {
-			g_print ("Invalid class specified\n");
-			exit (1);
-		}
-	}
-
-	if (level != NULL) {
-		if (strcmp (level, "quiet") == 0) {
-			test->level = LEVEL_QUIET;
-		} else if (strcmp (level, "normal") == 0) {
-			test->level = LEVEL_NORMAL;
-		} else if (strcmp (level, "all") == 0) {
-			test->level = LEVEL_ALL;
-		} else {
-			g_print ("Invalid level specified\n");
-			exit (1);
-		}
-	}
 
 	/* auto */
 	gpm_st_run_test (test, gpm_st_common);

Modified: trunk/src/gpm-self-test.h
==============================================================================
--- trunk/src/gpm-self-test.h	(original)
+++ trunk/src/gpm-self-test.h	Wed Sep  3 16:33:51 2008
@@ -21,35 +21,17 @@
 
 #include <glib.h>
 
-typedef enum
-{
-	CLASS_ALL,
-	CLASS_AUTO,
-	CLASS_MANUAL,
-	CLASS_LAST
-} GpmSelfTestClass;
-
-typedef enum
-{
-	LEVEL_QUIET,
-	LEVEL_NORMAL,
-	LEVEL_ALL,
-	LEVEL_LAST
-} GpmSelfTestLevel;
-
 typedef struct
 {
 	guint		 total;
 	guint		 succeeded;
 	gboolean	 started;
-	GpmSelfTestClass class;
-	GpmSelfTestLevel level;
 	gchar		*type;
 } GpmSelfTest;
 
 typedef void (*GpmSelfTestFunc) (GpmSelfTest *test);
 
-gboolean gpm_st_start (GpmSelfTest *test, const gchar *name, GpmSelfTestClass class);
+gboolean gpm_st_start (GpmSelfTest *test, const gchar *name);
 void gpm_st_end (GpmSelfTest *test);
 void gpm_st_title (GpmSelfTest *test, const gchar *format, ...);
 void gpm_st_success (GpmSelfTest *test, const gchar *format, ...);

Modified: trunk/test/gpm-st-hal-device.c
==============================================================================
--- trunk/test/gpm-st-hal-device.c	(original)
+++ trunk/test/gpm-st-hal-device.c	Wed Sep  3 16:33:51 2008
@@ -34,7 +34,7 @@
 	char *retstr;
 	gboolean ret;
 
-	if (gpm_st_start (test, "HalGDevice", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "HalGDevice") == FALSE) {
 		return;
 	}
 

Modified: trunk/test/gpm-st-hal-devicestore.c
==============================================================================
--- trunk/test/gpm-st-hal-devicestore.c	(original)
+++ trunk/test/gpm-st-hal-devicestore.c	Wed Sep  3 16:33:51 2008
@@ -35,7 +35,7 @@
 	HalGDevice *device3;
 	gboolean ret;
 
-	if (gpm_st_start (test, "HalGDevicestore", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "HalGDevicestore") == FALSE) {
 		return;
 	}
 

Modified: trunk/test/gpm-st-hal-manager.c
==============================================================================
--- trunk/test/gpm-st-hal-manager.c	(original)
+++ trunk/test/gpm-st-hal-manager.c	Wed Sep  3 16:33:51 2008
@@ -30,7 +30,7 @@
 	HalGManager *manager;
 	gboolean ret;
 
-	if (gpm_st_start (test, "HalGManager", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "HalGManager") == FALSE) {
 		return;
 	}
 

Modified: trunk/test/gpm-st-hal-power.c
==============================================================================
--- trunk/test/gpm-st-hal-power.c	(original)
+++ trunk/test/gpm-st-hal-power.c	Wed Sep  3 16:33:51 2008
@@ -30,7 +30,7 @@
 	HalGPower *power;
 	gboolean ret;
 
-	if (gpm_st_start (test, "HalGPower", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "HalGPower") == FALSE) {
 		return;
 	}
 

Modified: trunk/test/gpm-st-idletime.c
==============================================================================
--- trunk/test/gpm-st-idletime.c	(original)
+++ trunk/test/gpm-st-idletime.c	Wed Sep  3 16:33:51 2008
@@ -79,7 +79,7 @@
 	guint alarm;
 	guint i;
 
-	if (gpm_st_start (test, "LibIdletime", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "LibIdletime") == FALSE) {
 		return;
 	}
 

Modified: trunk/test/gpm-st-proxy.c
==============================================================================
--- trunk/test/gpm-st-proxy.c	(original)
+++ trunk/test/gpm-st-proxy.c	Wed Sep  3 16:33:51 2008
@@ -31,7 +31,7 @@
 	DbusProxy *gproxy = NULL;
 	DBusGProxy *proxy = NULL;
 
-	if (gpm_st_start (test, "DbusProxy", CLASS_AUTO) == FALSE) {
+	if (gpm_st_start (test, "DbusProxy") == FALSE) {
 		return;
 	}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]