seed r684 - in trunk: examples libseed tests tests/c



Author: hortont
Date: Thu Jan  8 09:08:23 2009
New Revision: 684
URL: http://svn.gnome.org/viewvc/seed?rev=684&view=rev

Log:
Integrate C tests into the little python test script.


Modified:
   trunk/examples/clutter-cogl.js
   trunk/libseed/seed-builtins.c
   trunk/tests/c/basic.c
   trunk/tests/c/main.c
   trunk/tests/run-tests.py

Modified: trunk/examples/clutter-cogl.js
==============================================================================
--- trunk/examples/clutter-cogl.js	(original)
+++ trunk/examples/clutter-cogl.js	Thu Jan  8 09:08:23 2009
@@ -1,4 +1,4 @@
-#!/usr/local/bin/seed
+#!/usr/bin/env seed
 Seed.import_namespace("Clutter");
 Seed.import_namespace("GLib");
 

Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c	(original)
+++ trunk/libseed/seed-builtins.c	Thu Jan  8 09:08:23 2009
@@ -313,17 +313,24 @@
 
 	arrayObj = JSObjectMake(local_eng->context, NULL, NULL);
 
-	for (i = 0; i < *argc; ++i)
+	if(argc)
 	{
-		// TODO: exceptions!
+		for (i = 0; i < *argc; ++i)
+		{
+			// TODO: exceptions!
 
-		JSObjectSetPropertyAtIndex(local_eng->context, arrayObj, i,
-								   seed_value_from_string(local_eng->context,
-														  (*argv)[i], 0), NULL);
-	}
-
-	argcref = seed_value_from_int(local_eng->context, *argc, 0);
+			JSObjectSetPropertyAtIndex(local_eng->context, arrayObj, i,
+									   seed_value_from_string(local_eng->context,
+															  (*argv)[i], 0), NULL);
+		}
 
+		argcref = seed_value_from_int(local_eng->context, *argc, 0);
+	}
+	else
+	{
+		argcref = seed_value_from_int(local_eng->context, 0, 0);
+	}
+	
 	seed_object_set_property(local_eng->context, arrayObj, "length", argcref);
 	seed_object_set_property(local_eng->context, obj, "argv", arrayObj);
 }

Modified: trunk/tests/c/basic.c
==============================================================================
--- trunk/tests/c/basic.c	(original)
+++ trunk/tests/c/basic.c	Thu Jan  8 09:08:23 2009
@@ -1,9 +1,12 @@
 #include "../../libseed/seed.h"
 #include "test-common.h"
 
-void basic (TestSimpleFixture * fixture, gconstpointer _data)
+void basica(TestSimpleFixture * fixture, gconstpointer _data)
 {
 	g_assert(1);
 }
 
-
+void basicb(TestSimpleFixture * fixture, gconstpointer _data)
+{
+	g_assert(1);
+}

Modified: trunk/tests/c/main.c
==============================================================================
--- trunk/tests/c/main.c	(original)
+++ trunk/tests/c/main.c	Thu Jan  8 09:08:23 2009
@@ -44,12 +44,13 @@
 
 	//g_test_bug_base ("http://bugzilla.openedhand.com/show_bug.cgi?id=%s";);
 
-	g_assert(seed_init(shared_state->argc_addr, shared_state->argv_addr) == 0);
+	SeedEngine * eng = seed_init(NULL, NULL);
 
 	shared_state->argc_addr = &argc;
 	shared_state->argv_addr = &argv;
 
-	TEST_SIMPLE ("/tests", basic);
+	TEST_SIMPLE ("/tests", basica);
+	TEST_SIMPLE ("/tests", basicb);
 
 	return g_test_run ();
 }

Modified: trunk/tests/run-tests.py
==============================================================================
--- trunk/tests/run-tests.py	(original)
+++ trunk/tests/run-tests.py	Thu Jan  8 09:08:23 2009
@@ -46,11 +46,26 @@
 			failed.append([f,test_retval,p.returncode,2]);
 			sys.stdout.write("x")
 		else:
-			passed.append([f,test_out,run_out])
+			passed.append([f])
 			sys.stdout.write(".")
 		sys.stdout.flush()
 
-#p = subprocess.Popen("
+p = subprocess.Popen(mcwd + "/c/test", shell=True,
+					 stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+					 stderr=subprocess.PIPE, close_fds=True);
+(c_out, c_err) = p.communicate()
+
+for c_test in c_out.rstrip().split("\n"):
+	c_status = c_test.split(": ");
+	a_error = c_err.rstrip().replace("**\nERROR:","").replace("\nAborted","")
+	if (len(c_status) < 2) or (c_status[1] != "OK"):
+		failed.append(["c_test" + c_status[0], "OK", a_error,1])
+		sys.stdout.write(".")
+	else:
+		passed.append([c_status[0]])
+	sys.stdout.flush()
+
+print
 
 revnof = os.popen("svn info | grep \"Revision\"")
 revno = "".join(revnof.readlines()).rstrip()



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