I have a small issue (regression?) when trying to boostrap latest Fantom (with Env changes in). When trying ./buildpods.fan full I get
TEST FAILED
sys::TestErr: Test failed: "e en" != "e en etc"
fan.sys.Test.err (Test.java:181)
fan.sys.Test.fail (Test.java:173)
fan.sys.Test.verifyEq (Test.java:96)
fan.sys.Test.verifyEq (Test.java:90)
testSys::EnvTest.verifyLocale (EnvTest.fan:266)
testSys::EnvTest.testLocale (EnvTest.fan:216)
which can be reproduced by typing fant testSys. However testSys::EnvTest or testSys::EnvTest.testLocale yield no error.
I also tried to run all previous tests from testSys in a shell loop to detect unintentional dependencies in test setups/teardowns but for i in $ALL_PREVIOUSLY_RUN_TESTS; do echo $i; fant "$i"; done went without an error too.
I can't spot an error in fant but I suspect the bug to appear only when tests are run in a single JVM session, like FS flushes or something similar.
brianSat 13 Feb 2010
that is sort of weird, could be some file locking issue
are you using a PathEnv setup?
KevinKelleySat 13 Feb 2010
Here's a PathEnv oddness...
If I run fant testSys::EnvTest with a PathEnv set to my working dir, I get a trace:
so it seems the test is trying to ensure that a "no-trailing-slash" uri can can be used, but PathEnv isn't cooperating.
katoxSat 13 Feb 2010
I wasn't using util::PathEnv. Both FAN_ENV and FAN_ENV_PATH were explicitly unset.
Running ./buildpods.fan compile fails with util::PathEnv but that probably caused by loading core libraries from the working location. I think that is expected.
CreateDir [file:/home/katox/git/fantom/dev/src/testNative/temp-java/]
Exec /usr/lib/jvm/java-6-sun/bin/java -cp /home/katox/git/fantom/dev/lib/java/sys.jar -Dfan.home=/home/katox/git/fantom/repo fanx.tools.Jstub -d /home/katox/git/fantom/dev/src/testNative/temp-java testNative
Java Stub testNative
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
ERROR: cannot init Sys.sysPod
fan.sys.Err: sys
at fan.sys.Err.make(Err.java:78)
Exception in thread "main" java.lang.ExceptionInInitializerError
at fan.sys.Pod.readFPod(Pod.java:140)
Caused by: java.lang.RuntimeException: Cannot boot fan: fan.sys.Err: sys
at fan.sys.Sys.initFail(Sys.java:522)
katoxFri 19 Feb 2010
I found the source of this issue. The key program flow is this:
1 Env.cur.props(typeof.pod,`locale/en.props`, 1ms)
2 f1 := etcDir + `locale/en.props`
3 f1.writeProps(["e":"e en etc", "f":"f en etc"])
4 x := Locale.fromStr("en")
5 verifyLocale(x, "e", "e en etc")
Line 1 caches locale/en.props in Env (props). Then in 2..3 a new version of en.props is properly written to the respective file. That file is only referenced (not used) in 4. The verification in 5 uses Env.cur.locale to construct a locale but because it supplies Duration.maxVal as maxAge a cached version is used and the newly created file is never read.
This wouldn't be a problem if the first line did not actually happen to be in a different test - PodTest, the rest is in EnvTest.
As the caching mechanism makes Env mutable I think we really should reinitialize it before each test to minimize this kind of surprises.
brianFri 19 Feb 2010
I'd hate to add complicated extra code paths just for self testing.
I wonder why I have never seen this problem.
You are seeing that PodTest runs before EnvTest and loads the cached locale settings?
The Pod tests aren't actually required since they just wrap Env tests anyways.
If you comment out PodTest.testProps will that fix the problem?
katoxFri 19 Feb 2010
I wonder why I have never seen this problem.
No idea how this could work somewhere, I'm scratching my head too. It is perfectly repeatable on my computers. A different order of tests maybe...
You are seeing that PodTest runs before EnvTest and loads the cached locale settings?
Yes. Running code in testProps loads the cache which is used in EnvTest later.
The Pod tests aren't actually required since they just wrap Env tests anyways.
Yes. But it's not the point - what I missed is that mutable Env was shared in a single test session.
If you comment out PodTest.testProps will that fix the problem?
katox Fri 12 Feb 2010
I have a small issue (regression?) when trying to boostrap latest Fantom (with Env changes in). When trying
./buildpods.fan fullI getwhich can be reproduced by typing
fant testSys. HowevertestSys::EnvTestortestSys::EnvTest.testLocaleyield no error.I also tried to run all previous tests from testSys in a shell loop to detect unintentional dependencies in test setups/teardowns but
for i in $ALL_PREVIOUSLY_RUN_TESTS; do echo $i; fant "$i"; donewent without an error too.I can't spot an error in
fantbut I suspect the bug to appear only when tests are run in a single JVM session, like FS flushes or something similar.brian Sat 13 Feb 2010
that is sort of weird, could be some file locking issue
are you using a PathEnv setup?
KevinKelley Sat 13 Feb 2010
Here's a PathEnv oddness...
If I run
fant testSys::EnvTestwith a PathEnv set to my working dir, I get a trace:but when I re-try with PathEnv turned off, no error. In
testFindFilethis is where the fail happens:so it seems the test is trying to ensure that a "no-trailing-slash" uri can can be used, but PathEnv isn't cooperating.
katox Sat 13 Feb 2010
I wasn't using
util::PathEnv. BothFAN_ENVandFAN_ENV_PATHwere explicitly unset.Running
./buildpods.fan compilefails withutil::PathEnvbut that probably caused by loading core libraries from the working location. I think that is expected.katox Fri 19 Feb 2010
I found the source of this issue. The key program flow is this:
1 Env.cur.props(typeof.pod,`locale/en.props`, 1ms) 2 f1 := etcDir + `locale/en.props` 3 f1.writeProps(["e":"e en etc", "f":"f en etc"]) 4 x := Locale.fromStr("en") 5 verifyLocale(x, "e", "e en etc")Line
1cacheslocale/en.propsinEnv(props). Then in2..3a new version ofen.propsis properly written to the respective file. That file is only referenced (not used) in4. The verification in5usesEnv.cur.localeto construct a locale but because it suppliesDuration.maxValasmaxAgea cached version is used and the newly created file is never read.This wouldn't be a problem if the first line did not actually happen to be in a different test -
PodTest, the rest is inEnvTest.As the caching mechanism makes
Envmutable I think we really should reinitialize it before each test to minimize this kind of surprises.brian Fri 19 Feb 2010
I'd hate to add complicated extra code paths just for self testing.
I wonder why I have never seen this problem.
You are seeing that PodTest runs before EnvTest and loads the cached locale settings?
The Pod tests aren't actually required since they just wrap Env tests anyways.
If you comment out PodTest.testProps will that fix the problem?
katox Fri 19 Feb 2010
No idea how this could work somewhere, I'm scratching my head too. It is perfectly repeatable on my computers. A different order of tests maybe...
Yes. Running code in
testPropsloads the cache which is used inEnvTestlater.Yes. But it's not the point - what I missed is that mutable
Envwas shared in a single test session.Yes, it fixes the problem.
brian Fri 19 Feb 2010
OK - I pushed a fix