[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9558: First draft of an haxe-based
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9558: First draft of an haxe-based testing framework plus some distribution |
Date: |
Mon, 04 Aug 2008 15:44:09 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9558
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Mon 2008-08-04 15:44:09 +0200
message:
First draft of an haxe-based testing framework plus some distribution
fixes (looks like we weren't distributing the testsuite if configure
didn't find the required tools to run them !)
added:
macros/haxe.m4
testsuite/misc-haxe.all/
testsuite/misc-haxe.all/Dejagnu.hx
testsuite/misc-haxe.all/Hello.hx
testsuite/misc-haxe.all/Makefile.am
testsuite/misc-haxe.all/check.as
modified:
Makefile.am
configure.ac
testsuite/Makefile.am
testsuite/misc-mtasc.all/Makefile.am
------------------------------------------------------------
revno: 9555.1.1
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Mon 2008-08-04 15:27:32 +0200
message:
First draft of an haxe-based testing framework for SWF9
added:
macros/haxe.m4
testsuite/misc-haxe.all/
testsuite/misc-haxe.all/Dejagnu.hx
testsuite/misc-haxe.all/Hello.hx
testsuite/misc-haxe.all/Makefile.am
testsuite/misc-haxe.all/check.as
modified:
Makefile.am
configure.ac
testsuite/Makefile.am
testsuite/misc-mtasc.all/Makefile.am
=== modified file 'Makefile.am'
--- a/Makefile.am 2008-07-23 10:35:04 +0000
+++ b/Makefile.am 2008-08-04 13:27:32 +0000
@@ -241,6 +241,10 @@
@echo " MTASC $(MTASC)"
@echo " MTASC CLASSPATH $(MTASC_CLASSPATH)"
endif
+if ENABLE_HAXE
+ @echo " HAXE $(HAXE)"
+ @echo " HAXE CLASSPATH $(HAXE_CLASSPATH)"
+endif
if ENABLE_SWFMILL
@echo " SWFMILL $(SWFMILL) "
endif
=== modified file 'configure.ac'
--- a/configure.ac 2008-08-01 05:05:54 +0000
+++ b/configure.ac 2008-08-04 13:27:32 +0000
@@ -1531,15 +1531,17 @@
AM_CONDITIONAL(ENABLE_SWFDEC_TESTSUITE, [ test x"$SWFDEC_TESTSUITE" != x ])
dnl
-dnl See if we can use the swfmill, mtasc and swfc based testsuites
+dnl See if we can use the swfmill, mtasc, swfc and haxe based testsuites
dnl
if test x$cross_compiling = xno; then
AC_PATH_PROG(SWFMILL, swfmill)
AC_PATH_PROG(SWFC, swfc)
AC_PATH_MTASC
+ AC_PATH_HAXE
fi
AM_CONDITIONAL(ENABLE_SWFMILL, [ test x"$SWFMILL" != x ])
AM_CONDITIONAL(ENABLE_MTASC, [ test x"$MTASC" != x ])
+AM_CONDITIONAL(ENABLE_HAXE, [ test x"$HAXE" != x ])
AM_CONDITIONAL(ENABLE_SWFC, [ test x"$SWFC" != x ])
AC_PATH_PROG(DOXYGEN, doxygen)
@@ -2110,6 +2112,7 @@
testsuite/swfdec/Makefile
testsuite/misc-ming.all/Makefile
testsuite/misc-mtasc.all/Makefile
+testsuite/misc-haxe.all/Makefile
testsuite/misc-swfmill.all/Makefile
testsuite/misc-swfc.all/Makefile
testsuite/movies.all/Makefile
@@ -2836,6 +2839,16 @@
echo " or .deb users: apt-get install mtasc" >&4
fi
+ if test x"$HAXE" != x; then
+ echo " HAXE is $HAXE"
+ echo " HAXE CLASSPATH is $HAXE_CLASSPATH"
+ else
+ echo " WARNING: You need to have the HAXE compiler packages
installed" >&4
+ echo " to run some of the tests in Gnash testsuite." >&4
+ echo " You can install it from http://haxe.org" >&4
+ echo " or .deb users: apt-get install haxe (version 2 or
later required)" >&4
+ fi
+
if test x"$SWFMILL" != x; then
echo " SWFMILL is $SWFMILL"
else
=== added file 'macros/haxe.m4'
--- a/macros/haxe.m4 1970-01-01 00:00:00 +0000
+++ b/macros/haxe.m4 2008-08-04 13:27:32 +0000
@@ -0,0 +1,72 @@
+dnl
+dnl Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+
+
+#
+# Use:
+# AC_PATH_HAXE
+#
+# Provides:
+# HAXE - Path to haxe executable
+# HAXE_CLASSPATH - Classpath for haxe
+#
+
+AC_DEFUN([AC_PATH_HAXE], [
+ HAXE=""
+ HAXE_CLASSPATH=""
+
+ AC_ARG_WITH(haxe, AC_HELP_STRING([--with-haxe=<path>], [Path to the haxe
executable]), [
+ case "${withval}" in
+ yes|no) ;;
+ *) HAXE=${withval} ;;
+ esac
+ ], HAXE="")
+
+ AC_ARG_WITH(haxe-classpath, AC_HELP_STRING([--with-haxe-classpath=<path>],
[CLASSPATH for haxe]), [
+ case "${withval}" in
+ yes|no) ;;
+ *) HAXE_CLASSPATH=${withval} ;;
+ esac
+ ], HAXE_CLASSPATH="")
+
+ if test x"$HAXE" = "x"; then
+ AC_PATH_PROG(HAXE, haxe, ,[${pathlist}])
+ fi
+
+ if test x"$HAXE" != "x" -a x"$HAXE_CLASSPATH" = "x"; then
+ # cross your fingers !
+ if test -d "`dirname ${HAXE}`/std"; then
+ dir="`dirname ${HAXE}`/std"
+ elif test -d "/usr/share/haxe"; then
+ dir="/usr/share/haxe/"
+ else
+ dnl FIXME
+ dir="/usr/share/haxe/"
+ fi
+ HAXE_CLASSPATH=$dir
+ fi
+
+
+ AC_SUBST(HAXE)
+ AC_SUBST(HAXE_CLASSPATH)
+])
+
+# Local Variables:
+# c-basic-offset: 2
+# tab-width: 2
+# indent-tabs-mode: nil
+# End:
=== modified file 'testsuite/Makefile.am'
--- a/testsuite/Makefile.am 2008-07-22 21:24:49 +0000
+++ b/testsuite/Makefile.am 2008-08-04 13:27:32 +0000
@@ -25,6 +25,10 @@
DIR_MTASC = misc-mtasc.all
endif
+if ENABLE_HAXE
+DIR_HAXE = misc-haxe.all
+endif
+
if ENABLE_SWFMILL
DIR_SWFMILL = misc-swfmill.all
endif
@@ -37,7 +41,21 @@
DIR_SWFDEC_TESTSUITE = swfdec
endif
-# movies.all
+DIST_SUBDIRS = \
+ libnet.all \
+ libbase \
+ libamf.all \
+ libcore.all \
+ samples \
+ swfdec \
+ misc-ming.all \
+ misc-mtasc.all \
+ misc-haxe.all \
+ misc-swfmill.all \
+ misc-swfc.all \
+ movies.all \
+ $(NULL)
+
SUBDIRS = \
. \
$(DIR_SWFDEC_TESTSUITE) \
@@ -48,6 +66,7 @@
samples \
$(DIR_MING) \
$(DIR_MTASC) \
+ $(DIR_HAXE) \
$(DIR_SWFMILL) \
$(DIR_SWFC) \
movies.all \
=== added directory 'testsuite/misc-haxe.all'
=== added file 'testsuite/misc-haxe.all/Dejagnu.hx'
--- a/testsuite/misc-haxe.all/Dejagnu.hx 1970-01-01 00:00:00 +0000
+++ b/testsuite/misc-haxe.all/Dejagnu.hx 2008-08-04 13:27:32 +0000
@@ -0,0 +1,187 @@
+// Dejagnu.as - HAXE class for dejagnu-like testing.
+//
+// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// 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 for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+//
+
+import flash.Lib;
+import flash.text.TextField;
+
+class Dejagnu {
+ static var passed = 0;
+ static var failed = 0;
+ static var xpassed = 0;
+ static var xfailed = 0;
+ static var untest = 0;
+ static var unresolve = 0;
+
+ // This is a trick to force our 'init' function
+ // to be automatically called at the start of the movie.
+ static var inithack = init();
+
+ static var tf:flash.text.TextField;
+
+ static function init() {
+ //if(dejagnu_module_initialized == 1) return;
+
+ // create a textfield to output to
+ tf = new flash.text.TextField();
+ tf.autoSize = flash.text.TextFieldAutoSize.LEFT;
+ //flash.Lib.current.createTextField("textout", 99, 10, 10, 500, 500);
+ flash.Lib.current.addChild(tf);
+
+ //dejagnu_module_initialized = 1;
+
+ return null;
+ }
+
+ static function fail (why) {
+ failed++;
+ var msg = 'FAILED: '+why;
+ xtrace(msg);
+ }
+
+ static function xfail(why) {
+ xfailed++;
+ var msg = 'XFAILED: '+why;
+ xtrace(msg);
+ }
+
+ static function pass(why) {
+ passed++;
+ var msg = 'PASSED: '+why;
+ flash.Lib.trace(msg);
+ }
+
+ static function xpass(why) {
+ xpassed++;
+ var msg = 'XPASSED: '+why;
+ flash.Lib.trace(msg);
+ }
+
+ static function testcount() {
+ var c = 0;
+ if ( passed > 0 ) c += passed;
+ if ( failed > 0 ) c += failed;
+ if ( xpassed > 0 ) c += xpassed;
+ if ( xfailed > 0 ) c += xfailed;
+ return c;
+ }
+
+ static function printtotals() {
+ xtrace('#passed: '+ passed);
+ xtrace('#failed: '+ failed);
+ if ( xpassed > 0 ) {
+ xtrace('#unexpected successes: '+ xpassed);
+ }
+ if ( xfailed > 0 ) {
+ xtrace('#expected failures: '+ xfailed);
+ }
+ xtrace('#total tests run: '+ testcount());
+ }
+
+ static public function totals(exp:Dynamic, msg:Dynamic) {
+ var obt = testcount();
+ if ( exp != null && obt != exp ) {
+ fail('Test run '+obt+' (expected '+exp+') '+msg);
+ } else {
+ pass('Test run '+obt+' '+msg);
+ }
+ }
+
+ static function xtotals(exp:Dynamic, msg:Dynamic) {
+ var obt = testcount();
+ if ( exp != null && obt != exp ) {
+ xfail('Test run '+obt+' (expected '+exp+') ['+msg+']');
+ } else {
+ xpass('Test run '+obt+' ['+msg+']');
+ }
+ }
+
+ static public function check_equals(obt:Dynamic, exp:Dynamic, msg) {
+ if(msg == null) msg = "";
+ if ( obt == exp )
+ pass(obt+' == '+exp+' '+msg);
+ else
+ fail('expected: "'+exp+'" , obtained: "'+obt+'" '+msg);
+ }
+
+ static public function xcheck_equals(obt:Dynamic, exp:Dynamic, msg)
+ {
+ if(msg == null) msg = "";
+ if ( obt == exp )
+ {
+ xpass(obt+' == '+exp+' '+msg);
+ }
+ else
+ {
+ xfail('expected: '+exp+' , obtained: '+obt+" "+msg);
+ }
+ }
+
+ static public function check(a : Dynamic, msg)
+ {
+ if ( a )
+ {
+ if ( msg != null ) pass(msg);
+ else pass(a);
+ }
+ else
+ {
+ if ( msg != null ) fail(msg);
+ else fail(a);
+ }
+ }
+
+ static public function xcheck(a : Dynamic, msg)
+ {
+ if ( a )
+ {
+ if ( msg != null ) xpass(msg);
+ else xpass(a);
+ }
+ else
+ {
+ if ( msg != null ) xfail(msg);
+ else xfail(a);
+ }
+ }
+
+ static public function note(msg) {
+ xtrace(msg);
+ }
+
+ static function xtrace(msg) {
+ tf.text += msg + "\n";
+ //flash.Lib.trace(msg);
+ }
+
+ static function untested(msg) {
+ flash.Lib.trace("UNTESTED: "+msg);
+ }
+
+ static function unresolved(msg) {
+ flash.Lib.trace("UNRESOLVED: "+msg);
+ }
+
+ static public function done() {
+ printtotals();
+ flash.Lib.trace("__END_OF_TEST__");
+ //loadMovie('fscommand:quit', _root);
+ }
+
+}
=== added file 'testsuite/misc-haxe.all/Hello.hx'
--- a/testsuite/misc-haxe.all/Hello.hx 1970-01-01 00:00:00 +0000
+++ b/testsuite/misc-haxe.all/Hello.hx 2008-08-04 13:27:32 +0000
@@ -0,0 +1,28 @@
+#include "check.as"
+
+// Class must be named with the PP prefix, as that's the name the
+// file passed to haxe will have after the preprocessing step
+class PP_Hello {
+ static function main()
+ {
+
+ var a = 1;
+
+ // This is how you call check_equals
+ check_equals(a, 1);
+
+ // This is how you call check
+ check(true);
+ check(!false);
+
+ // This is how you print notes (trace + visual trace)
+ note("Hello world");
+
+ // Check number of tests run (for consistency)
+ check_totals(3);
+
+ // Call this after finishing all tests. It prints out the
totals.
+ Dejagnu.done();
+
+ }
+}
=== added file 'testsuite/misc-haxe.all/Makefile.am'
--- a/testsuite/misc-haxe.all/Makefile.am 1970-01-01 00:00:00 +0000
+++ b/testsuite/misc-haxe.all/Makefile.am 2008-08-04 13:27:32 +0000
@@ -0,0 +1,97 @@
+## Process this fill with automake to generate Makefile.in
+#
+# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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 for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+AUTOMAKE_OPTIONS = dejagnu
+
+# These will get executed and parsed for test output
+SANE_ASTESTS = \
+ $(NULL)
+# These ones are the ones for which consistency check fail
+BOGUS_ASTESTS = \
+ Hello.hx \
+ $(NULL)
+
+ASTESTS = $(SANE_ASTESTS) $(BOGUS_ASTESTS)
+
+
+# These will get compiled to SWFs just as above, but will not be executed as a
test
+# They are for secondary movies to be loaded by the above tests.
+AUXMOVIES = \
+ $(NULL)
+
+EXTRA_DIST = $(ASTESTS) $(AUXMOVIES)
+
+HAXE_FLAGS = -swf-version 9 -cp $(HAXE_CLASSPATH) -cp $(srcdir)
+# hopefully preprocessor is builtin in this case
+HAXE_CPP = $(CPP) -x c -P -I$(srcdir)
+
+SANE_ASTESTS_OUT = $(SANE_ASTESTS:.hx=.swf)
+BOGUS_ASTESTS_OUT = $(BOGUS_ASTESTS:.hx=.swf)
+ASTESTS_OUT = $(SANE_ASTESTS_OUT) $(BOGUS_ASTESTS_OUT)
+
+AUXMOVIES_OUT = $(AUXMOVIES:.hx=.swf)
+
+$(ASTESTS_OUT) $(AUXMOVIES_OUT): Dejagnu.hx check.as
+
+
+TEST_DRIVERS = ../simple.exp
+TEST_CASES = \
+ sanetests-runner \
+ bogustests-runner \
+ $(NULL)
+
+sanetests-runner: $(srcdir)/../generic-testrunner.sh $(SANE_ASTESTS_OUT)
$(AUXMOVIES_OUT) Makefile
+ sh $< -c __END_OF_TEST__ -r 50 $(top_builddir) $(SANE_ASTESTS_OUT) > $@
+ chmod 755 $@
+
+bogustests-runner: $(srcdir)/../generic-testrunner.sh $(BOGUS_ASTESTS_OUT)
$(AUXMOVIES_OUT) Makefile
+ sh $< -C __END_OF_TEST__ -r 50 $(top_builddir) $(BOGUS_ASTESTS_OUT) > $@
+ chmod 755 $@
+
+.hx.swf:
+ $(HAXE_CPP) $< > $(@:%.swf=PP_%.hx)
+ $(HAXE) $(HAXE_FLAGS) -swf $@ -main $(@:%.swf=PP_%.hx)
+
+CLEANFILES = \
+ gnash-dbg.log \
+ site.exp.bak \
+ *-runner \
+ testrun.* \
+ *.swf \
+ PP_*.hx \
+ *_testrunner \
+ *_Runner
+
+check-DEJAGNU: site-update $(TEST_CASES)
+ @runtest=$(RUNTEST); \
+ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
+ GNASH_GC_TRIGGER_THRESHOLD=0 GNASHRC=../gnashrc $$runtest
$(RUNTESTFLAGS) $(TEST_DRIVERS); true; \
+ else \
+ echo "WARNING: could not find \`runtest'" 1>&2; \
+ for i in "$(TEST_CASES)"; do \
+ GNASH_GC_TRIGGER_THRESHOLD=0 GNASHRC=../gnashrc $(SHELL) $$i; \
+ done; \
+ fi
+
+site-update: site.exp
+ @rm -fr site.exp.bak
+ @cp site.exp site.exp.bak
+ @sed -e '/testcases/d' site.exp.bak > site.exp
+ @echo "# This is a list of the pre-compiled testcases" >> site.exp
+ @echo "set testcases \"$(TEST_CASES)\"" >> site.exp
+
=== added file 'testsuite/misc-haxe.all/check.as'
--- a/testsuite/misc-haxe.all/check.as 1970-01-01 00:00:00 +0000
+++ b/testsuite/misc-haxe.all/check.as 2008-08-04 13:27:32 +0000
@@ -0,0 +1,52 @@
+// check.as - Include file for MTASC testcases providing common testing
facilities
+//
+// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// 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 for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+//
+// Original author: David Rorex - address@hidden
+//
+
+#ifndef _CHECK_AS_
+#define _CHECK_AS_
+
+#define _INFO_ ' ['+__FILE__+':'+__LINE__+']'
+
+// First argument is the expression we test, second is the result we expect
+#define check_equals(obt, exp) Dejagnu.check_equals(obt, exp, _INFO_)
+
+// First argument is the expression we test, second is the result we expect
+#define xcheck_equals(obt, exp) Dejagnu.xcheck_equals(obt, exp, _INFO_)
+
+#define check(a) Dejagnu.check(a, #a+' '+_INFO_)
+#define xcheck(a) Dejagnu.xcheck(a, #a+' '+_INFO_)
+
+#define pass(text) Dejagnu.pass(text + _INFO_)
+#define xpass(text) Dejagnu.xpass(text + _INFO_)
+#define fail(text) Dejagnu.fail(text + _INFO_)
+#define xfail(text) Dejagnu.xfail(text + _INFO_)
+#define pass(text) Dejagnu.pass(text + _INFO_)
+#define untested(text) Dejagnu.untested(text + _INFO_)
+#define unresolved(text) Dejagnu.unresolved(text + _INFO_)
+
+#define check_totals(n) Dejagnu.totals(n, _INFO_)
+#define xcheck_totals(n) Dejagnu.xtotals(n, _INFO_)
+
+#define note(text) Dejagnu.note(text + _INFO_)
+
+import Dejagnu;
+
+#endif
=== modified file 'testsuite/misc-mtasc.all/Makefile.am'
--- a/testsuite/misc-mtasc.all/Makefile.am 2008-06-09 19:53:46 +0000
+++ b/testsuite/misc-mtasc.all/Makefile.am 2008-08-04 13:27:32 +0000
@@ -45,7 +45,7 @@
level87.as \
$(NULL)
-EXTRA_DIST = $(ASTESTS) $(AUXMOVIES) TestClass.as ../check.h Dejagnu.as
check.as Derived1.as Base1.as implementsOp/BExtendingImplementation.as
implementsOp/ImplementationA.as implementsOp/ImplementationB.as
implementsOp/SimpleInterface.as
+EXTRA_DIST = $(ASTESTS) $(AUXMOVIES) TestClass.as Dejagnu.as check.as
Derived1.as Base1.as implementsOp/BExtendingImplementation.as
implementsOp/ImplementationA.as implementsOp/ImplementationB.as
implementsOp/SimpleInterface.as
MTASC_FLAGS = -version 6 -cp $(MTASC_CLASSPATH) -cp $(srcdir) -v -header
800:600:20
MTASC_CPP = $(CPP) -x c -P -I$(srcdir)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9558: First draft of an haxe-based testing framework plus some distribution,
Sandro Santilli <=