gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9710: Add read/write test for Share


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9710: Add read/write test for SharedObject (self-contained).
Date: Wed, 10 Sep 2008 11:20:47 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9710
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-09-10 11:20:47 +0200
message:
  Add read/write test for SharedObject (self-contained).
added:
  testsuite/misc-ming.all/SharedObjectTest.as
  testsuite/misc-ming.all/SharedObjectTest.sol/
  testsuite/misc-ming.all/SharedObjectTest.sol/README
  testsuite/misc-ming.all/SharedObjectTest.sol/sol1.sol
  testsuite/misc-ming.all/SharedObjectTestRunner.sh
modified:
  testsuite/misc-ming.all/Makefile.am
    ------------------------------------------------------------
    revno: 9709.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 11:06:37 +0200
    message:
      Add automated testing for read/write of .sol files 
    added:
      testsuite/misc-ming.all/SharedObjectTest.as
      testsuite/misc-ming.all/SharedObjectTest.sol/
      testsuite/misc-ming.all/SharedObjectTest.sol/sol1.sol
      testsuite/misc-ming.all/SharedObjectTestRunner.sh
    modified:
      testsuite/misc-ming.all/Makefile.am
    ------------------------------------------------------------
    revno: 9709.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 11:07:29 +0200
    message:
      update comment abow how the test works
    modified:
      testsuite/misc-ming.all/SharedObjectTestRunner.sh
    ------------------------------------------------------------
    revno: 9709.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 11:16:02 +0200
    message:
      add notes about the SharedObject test
    added:
      testsuite/misc-ming.all/SharedObjectTest.sol/README
=== modified file 'testsuite/misc-ming.all/Makefile.am'
--- a/testsuite/misc-ming.all/Makefile.am       2008-08-20 16:15:55 +0000
+++ b/testsuite/misc-ming.all/Makefile.am       2008-09-10 09:06:37 +0000
@@ -18,6 +18,7 @@
 
 AUTOMAKE_OPTIONS = dejagnu -Wno-portability
 
+abs_top_builddir=$(shell cd $(top_builddir); pwd)
 abs_builddir=$(shell cd $(top_builddir)/testsuite/misc-ming.all; pwd)
 abs_mediadir = $(shell cd $(srcdir)/../media; pwd)
 
@@ -35,9 +36,12 @@
        gotoFrame2Test.as \
        DrawingApiTest.as \
        FlashVarsTest.as \
+       SharedObjectTest.as \
        intervalTest.as \
        FlashVarsTest.html \
-       StageConfigTest.as
+       StageConfigTest.as \
+       SharedObjectTest.sol/sol1.sol \
+       SharedObjectTest.sol/README 
 
 
 AM_CPPFLAGS = \
@@ -281,7 +285,8 @@
 if MAKESWF_SUPPORTS_PREBUILT_CLIPS
 check_SCRIPTS += VarAndCharClashTest-Runner \
        gotoFrame2Test-Runner \
-       FlashVarsTest-Runner
+       FlashVarsTest-Runner \
+       SharedObjectTestRunner
 endif
 
 if MING_VERSION_0_4
@@ -1565,6 +1570,14 @@
        echo "$(top_builddir)/gui/gnash -1 -r0 -v -P 
'FlashVars=?a=a_in_fvars&v=v_in_fvars&MixCaseFvars=mixFvars&dejagnu.nested=chFVars&_root.fqv=fqFVars&complex={a:'1',b:2}'
 
'FlashVarsTest.swf?a=a_in_qstring&q=q_in_qstring&MixCaseQstr=mixQstr&dejagnu.nested=chQstr&_root.fqv=fqQstr'"
 > $@
        chmod 755 $@
 
+# This will only work with Ming-0.4.0beta2 (support for prebuilt clips 
inclusion)
+SharedObjectTest.swf: Dejagnu.swf $(srcdir)/SharedObjectTest.as 
+       $(MAKESWF) -DOUTPUT_VERSION=6 -v6 -o $@ Dejagnu.swf 
$(srcdir)/SharedObjectTest.as
+
+SharedObjectTestRunner: SharedObjectTestRunner.sh Makefile SharedObjectTest.swf
+       sed $< -e 's#@@TOP_BUILDDIR@@#${abs_top_builddir}#' -e 
's#@@BASEINPUTSOLDIR@@#${srcdir}/SharedObjectTest.sol#' > $@
+       chmod +x $@
+
 StageConfigTest.swf: $(srcdir)/StageConfigTest.as 
        $(MAKESWF) -o $@ -s 512x512 $(srcdir)/StageConfigTest.as
 

=== added file 'testsuite/misc-ming.all/SharedObjectTest.as'
--- a/testsuite/misc-ming.all/SharedObjectTest.as       1970-01-01 00:00:00 
+0000
+++ b/testsuite/misc-ming.all/SharedObjectTest.as       2008-09-10 09:06:37 
+0000
@@ -0,0 +1,59 @@
+// 
+//   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
+
+
+so1 = SharedObject.getLocal("sol1");
+
+check_equals(so1.data.num, 2);
+check_equals(so1.data.str, 'a string');
+check_equals(typeof(so1.data.tbool), 'boolean');
+check_equals(so1.data.tbool, true);
+check_equals(typeof(so1.data.fbool), 'boolean');
+check_equals(so1.data.fbool, false);
+check_equals(typeof(so1.data.ary), 'object');
+check_equals(so1.data.ary.toString(), '1,2,3');
+check_equals(typeof(so1.data.obj), 'object');
+check_equals(typeof(so1.data.obj.a), 'number');
+check_equals(so1.data.obj.a, 10);
+check_equals(typeof(so1.data.obj.b), 'string');
+check_equals(so1.data.obj.b, '20');
+check_equals(typeof(so1.data.obj.c), 'boolean');
+check_equals(so1.data.obj.c, true);
+check_equals(so1.data.ref, so1.data.obj);
+
+// force writing the sol or the adobe player won't save it
+// again. This will also serve as a kind of reference for
+// how the sol file was produced in the first place
+so1.data.num = 2; 
+so1.data.str = 'a string'; 
+so1.data.tbool = true;
+so1.data.fbool = false;
+so1.data.ary = [1,2,3];
+so1.data.obj = {a:10,b:'20',c:true};
+so1.data.ref = so1.data.obj;
+
+so1.flush();
+
+quit = function()
+{
+       loadMovie('fscommand:quit', '');
+};
+note(" Will quit in 1 seconds");
+setInterval(quit, 1000);
+stop();
+
+totals();

=== added directory 'testsuite/misc-ming.all/SharedObjectTest.sol'
=== added file 'testsuite/misc-ming.all/SharedObjectTest.sol/README'
--- a/testsuite/misc-ming.all/SharedObjectTest.sol/README       1970-01-01 
00:00:00 +0000
+++ b/testsuite/misc-ming.all/SharedObjectTest.sol/README       2008-09-10 
09:16:02 +0000
@@ -0,0 +1,5 @@
+This directory is used as input for the misc-ming.all/SharedObjectTestRunner
+script. Files here will be copied to a player's SOLDIR and the 
SharedObjectTest.swf
+will be played, containing tests for reading the sol files.
+Finally on player exit the script checks if the sol file was written and if it
+matches the input one.

=== added file 'testsuite/misc-ming.all/SharedObjectTest.sol/sol1.sol'
Binary files a/testsuite/misc-ming.all/SharedObjectTest.sol/sol1.sol    
1970-01-01 00:00:00 +0000 and 
b/testsuite/misc-ming.all/SharedObjectTest.sol/sol1.sol   2008-09-10 09:06:37 
+0000 differ
=== added file 'testsuite/misc-ming.all/SharedObjectTestRunner.sh'
--- a/testsuite/misc-ming.all/SharedObjectTestRunner.sh 1970-01-01 00:00:00 
+0000
+++ b/testsuite/misc-ming.all/SharedObjectTestRunner.sh 2008-09-10 09:07:29 
+0000
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# 
+#   Copyright (C) 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
+# 
+
+#
+# This script will copy all the SOL files found in the INPUTSOLDIR
+# to the actual runtime sol dir, play a file and then compare saved
+# sol files at the end with input ones.
+#
+# Called w/out arguments will use gprocessor as player, SharedObjectTest.sol/
+# as input sol dir and testsuite/tmpSharedObject as runtime sol dir.
+#
+# You can pass arguments to change player and runtime sol dir for testing
+# with the adobe player. Example:
+#
+# $ ./SharedObjectTestRunner flashplayer 
'/home/strk/.macromedia/Flash_Player/#SharedObjects/KZNLGTEU/'
+#
+# When you pass the second argument, the script will assume you're running with
+# the proprietary player thus stripping the ^/home/ portion out of SWF filename
+# (as this is what seems to happen)
+#
+#
+
+TOP_BUILDDIR=@@TOP_BUILDDIR@@
+BASEINPUTSOLDIR=@@BASEINPUTSOLDIR@@
+PLAYER="${TOP_BUILDDIR}/utilities/gprocessor -v"
+
+INPUTSOLDIR=${BASEINPUTSOLDIR}
+SWFTEST=${TOP_BUILDDIR}/testsuite/misc-ming.all/SharedObjectTest.swf
+SOLDIR=${TOP_BUILDDIR}/testsuite/tmpSharedObject/localhost/${SWFTEST}/
+
+if [ -n "$1" ]; then PLAYER="$1"; fi
+if [ -n "$2" ]; then
+    homestrip=`echo ${SWFTEST} | sed -e 's#^/home/##'`
+    SOLDIR="$2/localhost/${homestrip}";
+fi
+
+mkdir -p ${SOLDIR} # just in case..
+
+rm ${SOLDIR}/* # clean target soldir out
+cp -v ${INPUTSOLDIR}/*.sol ${SOLDIR}/
+touch ${SOLDIR}/copytime
+echo "SWF=${SWFTEST}"
+echo "INPUT=${SOLDIR}"
+echo "SOLDIR=${SOLDIR}"
+sleep 1
+
+export GNASHRC=${TOP_BUILDDIR}/testsuite/gnashrc
+${PLAYER} ${SWFTEST}
+
+cd ${SOLDIR}; find . -cnewer ${SOLDIR}/copytime | sed 'address@hidden/@@' > 
${SOLDIR}/newfiles; cd -
+
+for f in ${INPUTSOLDIR}/*.sol; do
+       solname=`basename ${f}`
+       if ! grep -w ${solname} ${SOLDIR}/newfiles; then
+               echo "FAILED: ${solname} wasn't saved"
+               continue
+       fi
+       if ! cmp ${INPUTSOLDIR}/${solname} ${SOLDIR}/${solname}; then
+               echo "FAILED: ! cmp ${SOLDIR}/${solname} 
${INPUTSOLDIR}/${solname}"
+               continue
+       fi
+       echo "PASSED: SharedObject ${solname} matches input"
+done


reply via email to

[Prev in Thread] Current Thread [Next in Thread]