Discussion:
[Contiki-developers] Cooja Test Scripts broken
Alexander Bernauer
2012-01-30 16:10:55 UTC
Permalink
Hi

I have troubles running Cooja test scripts.

First, the following example script, that is deployed with Cooja, fails.

---8<---
TIMEOUT(60000);
while (true) {
log.log(time + ":" + id + ":" + msg + "\n");
YIELD();
}
--->8---

---8<---
[...]
Test script error, terminating Cooja.
[...]
TypeError: Cannot find log in object se.sics.cooja.plugins.LogScriptEngine
[...]
--->8---

Second, after pulling the recent master commit
(66868253f02b9bc2028539f23d467a0c7b3589d0), Cooja does not even build
any more:
---8<---
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:84: non-static variable startOffset cannot be referenced from a static context
[javac] Arrays.fill(data, CoffeeConfiguration.startOffset + offset, size, (byte)0);
[javac] ^
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:100: non-static variable startOffset cannot be referenced from a static context
[javac] System.arraycopy(data, CoffeeConfiguration.startOffset + offset, bytes, 0, size);
[javac] ^
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:108: non-static variable startOffset cannot be referenced from a static context
[javac] System.arraycopy(bytes, 0, data, CoffeeConfiguration.startOffset + offset, size);
--->8---

What's the status of Cooja Test Scripts? Is it still supported? Is there
a particular tag I should use? Any other recommendations?

Greetings

Alex
Sébastien Dawans
2012-01-30 16:27:44 UTC
Permalink
Hello,
Which version of java are you using? I had a similar error on one of my
test machines the other day because I messed up the installation - I was
using open JRE instead of the Sun version. The Sun version is no longer
available in the most recent debian packages but you can still find some
old deb files that run fine.

If that's not it, sorry ;)

Sébastien
Post by Alexander Bernauer
Hi
I have troubles running Cooja test scripts.
First, the following example script, that is deployed with Cooja, fails.
---8<---
TIMEOUT(60000);
while (true) {
log.log(time + ":" + id + ":" + msg + "\n");
YIELD();
}
--->8---
---8<---
[...]
Test script error, terminating Cooja.
[...]
TypeError: Cannot find log in object se.sics.cooja.plugins.LogScriptEngine
[...]
--->8---
Second, after pulling the recent master commit
(66868253f02b9bc2028539f23d467a0c7b3589d0), Cooja does not even build
---8<---
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:84: non-static variable startOffset cannot be referenced from a static context
[javac] Arrays.fill(data, CoffeeConfiguration.startOffset + offset, size, (byte)0);
[javac] ^
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:100: non-static variable startOffset cannot be referenced from a static context
[javac] System.arraycopy(data, CoffeeConfiguration.startOffset + offset, bytes, 0, size);
[javac] ^
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:108: non-static variable startOffset cannot be referenced from a static context
[javac] System.arraycopy(bytes, 0, data, CoffeeConfiguration.startOffset + offset, size);
--->8---
What's the status of Cooja Test Scripts? Is it still supported? Is there
a particular tag I should use? Any other recommendations?
Greetings
Alex
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Contiki-developers mailing list
https://lists.sourceforge.net/lists/listinfo/contiki-developers
Alexander Bernauer
2012-01-31 10:57:44 UTC
Permalink
Hi Sébastien,

thank you for sharing your experience. You were right, the JVM
implementation is the problem.

With the JVM from SUN's JDK 1.6.0_21 (32 bit) everything is fine, even
if compilation is done still done with OpenJDK's javac.

Seems like the Rhino magic uses either some non-standard features that
SUN's JVM provides or OpenJDK is not standard compliant.

Do we want to investigate this any further? Or do we simply depend on
SUN's JVM? If so, this dependency should be documented for example here
[1]

Greetings

Alex

[1]
http://www.sics.se/contiki/wiki/index.php?title=An_Introduction_to_Cooja
Moritz Struebe
2012-01-30 16:40:22 UTC
Permalink
Hi,

[1] should fix your problem.

Fredrik made quite a few changes to the Cooja code. I haven't tested
those yet, so you might want to use [2].

I'm building my ppa[3] off [4], which I use for test-runs.

Cheers
Morty


[1] http://i4git.cs.fau.de/contiki.git/blob/patches:/cooja_fix_missing_msg
[2]
http://contiki.git.sourceforge.net/git/gitweb.cgi?p=contiki/contiki;a=commit;h=acb2c28f
[3] https://code.launchpad.net/~morty/+archive/cooja
[4]
http://i4git.informatik.uni-erlangen.de/contiki.git/shortlog/refs/heads/master
Post by Alexander Bernauer
Hi
I have troubles running Cooja test scripts.
First, the following example script, that is deployed with Cooja, fails.
---8<---
TIMEOUT(60000);
while (true) {
log.log(time + ":" + id + ":" + msg + "\n");
YIELD();
}
--->8---
---8<---
[...]
Test script error, terminating Cooja.
[...]
TypeError: Cannot find log in object se.sics.cooja.plugins.LogScriptEngine
[...]
--->8---
Second, after pulling the recent master commit
(66868253f02b9bc2028539f23d467a0c7b3589d0), Cooja does not even build
---8<---
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:84: non-static variable startOffset cannot be referenced from a static context
[javac] Arrays.fill(data, CoffeeConfiguration.startOffset + offset, size, (byte)0);
[javac] ^
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:100: non-static variable startOffset cannot be referenced from a static context
[javac] System.arraycopy(data, CoffeeConfiguration.startOffset + offset, bytes, 0, size);
[javac] ^
[javac] /home/alex/scm/contiki/tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/interfaces/CoojaM25P80.java:108: non-static variable startOffset cannot be referenced from a static context
[javac] System.arraycopy(bytes, 0, data, CoffeeConfiguration.startOffset + offset, size);
--->8---
What's the status of Cooja Test Scripts? Is it still supported? Is there
a particular tag I should use? Any other recommendations?
Greetings
Alex
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Contiki-developers mailing list
https://lists.sourceforge.net/lists/listinfo/contiki-developers
--
Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter)
Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme)
Friedrich-Alexander-Universität Erlangen-Nürnberg
Martensstr. 1
91058 Erlangen

Tel : +49 9131 85-25419
Fax : +49 9131 85-28732
eMail : ***@informatik.uni-erlangen.de
WWW : http://www4.informatik.uni-erlangen.de/~morty
Alexander Bernauer
2012-01-31 10:32:42 UTC
Permalink
Hi Morty,

thank you for your help. Unfortunatelly, it didn't work.

---8<---
$ git remote add morty git://i4git.informatik.uni-erlangen.de/contiki.git
$ git fetch --all

$ (cd tools/cooja; ant clean)
$ git clean -d -f -x
$ git reset --hard HEAD

$ git checkout acb2c28fdde95ba41b2197d7b9657ef3437d4514 # [2]
$ git cat-file -p 6141d375b9521e7dd693ae7bda1e448a39174cd3 | patch -p1 # [1]

$ cd tools/cooja
$ ant run

- load examples/rime/example-collect.csc
- load Contiki Test Editor plugin
- select "just log all printfs and timeout" script
- activate script
- run simulation

[java] FATAL [Thread-3] (LogScriptEngine.java:334) - Script error:
[java] java.lang.reflect.UndeclaredThrowableException
[java] at $Proxy4.run(Unknown Source)
[java] at se.sics.cooja.plugins.LogScriptEngine$5.run(LogScriptEngine.java:317)
[java] at java.lang.Thread.run(Thread.java:636)
[java] Caused by: java.security.PrivilegedActionException: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function log in object se.sics.cooja.plugins.LogScriptEngine$***@1e940a6. (<Unknown source>#13) in <Unknown source> at line number 13
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler.invoke(InterfaceImplementor.java:66)
[java] ... 3 more
[java] Caused by: javax.script.ScriptException: sun.org.mozilla.javascript.EcmaError: TypeError: Cannot find function log in object se.sics.cooja.plugins.LogScriptEngine$***@1e940a6. (<Unknown source>#13) in <Unknown source> at line number 13
[java] at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:209)
[java] at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:167)
[java] at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler$1.run(InterfaceImplementor.java:69)
[java] ... 5 more
--->8---

And weirdly enough, the same happens with your master:
---8<---
$ [ant clean, git clean, git reset]
$ git checkout 86e485344988a91c4edc3a8229f38585b44496b3 # [4]
$ cd tools/cooja
$ ant run

- load examples/rime/example-collect.csc
- load Contiki Test Editor plugin
- select "just log all printfs and timeout" script
- activate script
- run simulation

[java] FATAL [Thread-3] (LogScriptEngine.java:351) - Test script error: TypeError: Cannot find function log in object se.sics.cooja.plugins.LogScriptEngine$***@152b6f5. ( Line 13 )
--->8---

What could be differnt in my environment?
---8<---
$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (6b20-1.9.10-0ubuntu1~10.10.3)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

$ uname -a
Linux apus 2.6.35-32-generic #64-Ubuntu SMP Tue Jan 3 00:47:07 UTC 2012 x86_64 GNU/Linux
--->8---

What can I do?

Greetings

Alex
Post by Moritz Struebe
[1] http://i4git.cs.fau.de/contiki.git/blob/patches:/cooja_fix_missing_msg
[2]
http://contiki.git.sourceforge.net/git/gitweb.cgi?p=contiki/contiki;a=commit;h=acb2c28f
[3] https://code.launchpad.net/~morty/+archive/cooja
[4]
http://i4git.informatik.uni-erlangen.de/contiki.git/shortlog/refs/heads/master
Moritz Struebe
2012-01-31 11:38:41 UTC
Permalink
Ah ok,

I didn't think of the JDK--Problem. My patch helps if Cooja times out
without any output to the serial port.

Cheers
Morty
Post by Alexander Bernauer
Hi Morty,
thank you for your help. Unfortunatelly, it didn't work.
---8<---
$ git remote add morty git://i4git.informatik.uni-erlangen.de/contiki.git
$ git fetch --all
$ (cd tools/cooja; ant clean)
$ git clean -d -f -x
$ git reset --hard HEAD
$ git checkout acb2c28fdde95ba41b2197d7b9657ef3437d4514 # [2]
$ git cat-file -p 6141d375b9521e7dd693ae7bda1e448a39174cd3 | patch -p1 # [1]
$ cd tools/cooja
$ ant run
- load examples/rime/example-collect.csc
- load Contiki Test Editor plugin
- select "just log all printfs and timeout" script
- activate script
- run simulation
[java] java.lang.reflect.UndeclaredThrowableException
[java] at $Proxy4.run(Unknown Source)
[java] at se.sics.cooja.plugins.LogScriptEngine$5.run(LogScriptEngine.java:317)
[java] at java.lang.Thread.run(Thread.java:636)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler.invoke(InterfaceImplementor.java:66)
[java] ... 3 more
[java] at com.sun.script.javascript.RhinoScriptEngine.invoke(RhinoScriptEngine.java:209)
[java] at com.sun.script.javascript.RhinoScriptEngine.invokeFunction(RhinoScriptEngine.java:167)
[java] at com.sun.script.util.InterfaceImplementor$InterfaceImplementorInvocationHandler$1.run(InterfaceImplementor.java:69)
[java] ... 5 more
--->8---
---8<---
$ [ant clean, git clean, git reset]
$ git checkout 86e485344988a91c4edc3a8229f38585b44496b3 # [4]
$ cd tools/cooja
$ ant run
- load examples/rime/example-collect.csc
- load Contiki Test Editor plugin
- select "just log all printfs and timeout" script
- activate script
- run simulation
--->8---
What could be differnt in my environment?
---8<---
$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.10) (6b20-1.9.10-0ubuntu1~10.10.3)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
$ uname -a
Linux apus 2.6.35-32-generic #64-Ubuntu SMP Tue Jan 3 00:47:07 UTC 2012 x86_64 GNU/Linux
--->8---
What can I do?
Greetings
Alex
Post by Moritz Struebe
[1] http://i4git.cs.fau.de/contiki.git/blob/patches:/cooja_fix_missing_msg
[2]
http://contiki.git.sourceforge.net/git/gitweb.cgi?p=contiki/contiki;a=commit;h=acb2c28f
[3] https://code.launchpad.net/~morty/+archive/cooja
[4]
http://i4git.informatik.uni-erlangen.de/contiki.git/shortlog/refs/heads/master
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Contiki-developers mailing list
https://lists.sourceforge.net/lists/listinfo/contiki-developers
--
Dipl.-Ing. Moritz 'Morty' Struebe (Wissenschaftlicher Mitarbeiter)
Lehrstuhl für Informatik 4 (Verteilte Systeme und Betriebssysteme)
Friedrich-Alexander-Universität Erlangen-Nürnberg
Martensstr. 1
91058 Erlangen

Tel : +49 9131 85-25419
Fax : +49 9131 85-28732
eMail : ***@informatik.uni-erlangen.de
WWW : http://www4.informatik.uni-erlangen.de/~morty
Loading...