Closed josevalim closed 11 years ago
Great job, guys! I've got 16 failures and 5 errors in tests on my Windows machine:
==> kernel (exunit) ................................................................................ ................................................................................ FF....FFF......................F................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ................................................................................ ...................\ (TokenMissingError) nofile:1: missing terminator: ] (for " [" starting at line 1) :erlang.system_info({:purify,'Node: nonode@nohost'}) init.erl:757: :init.do_boot/3
.\ (SyntaxError) nofile:1: unexpected token: end :erlang.system_info({:purify,'Node: nonode@nohost'}) init.erl:757: :init.do_boot/3
F\ (SyntaxError) nofile:1: invalid token: \x{3042} :erlang.system_info({:purify,'Node: nonode@nohost'}) init.erl:757: :init.do_boot/3
\ (throw) 1 erl_eval.erl:569: :erl_eval.do_apply/6 src/elixir.erl:152: :elixir.eval_forms/3 u:/elixir/lib/elixir/lib/code.ex:113: Code.do_eval_string/3 u:/elixir/lib/elixir/lib/kernel/cli.ex:264: Kernel.CLI.process_command/2 u:/elixir/lib/elixir/lib/enum.ex:604: Enum."-map/2-lc$^0/1-0-"/2 u:/elixir/lib/elixir/lib/kernel/cli.ex:18: Kernel.CLI."-main/1-fun-2-"/1 u:/elixir/lib/elixir/lib/kernel/cli.ex:39: Kernel.CLI.run/2 init.erl:1054: :init.start_it/1
* (SyntaxError) nofile:1: invalid token: ц .* (ErlangError) erlang error: 1 erl_eval.erl:569: :erl_eval.do_apply/6 src/elixir.erl:152: :elixir.eval_forms/3 u:/elixir/lib/elixir/lib/code.ex:113: Code.do_eval_string/3 u:/elixir/lib/elixir/lib/kernel/cli.ex:264: Kernel.CLI.process_command/2 u:/elixir/lib/elixir/lib/enum.ex:604: Enum."-map/2-lc$^0/1-0-"/2 u:/elixir/lib/elixir/lib/kernel/cli.ex:18: Kernel.CLI."-main/1-fun-2-"/1 u:/elixir/lib/elixir/lib/kernel/cli.ex:39: Kernel.CLI.run/2 init.erl:1054: :init.start_it/1
...................F............................................................ ................................................................................ ................................................................................ ................................................................................ .................F..............................FFFF....................F....... ....FF.......................
Failures:
1) test_absname_with_binary (PathTest) \ (ExUnit.ExpectationError) expected: "u:/foo/bar" to be equal to (==): "/foo/bar" at test/elixir/path_test.exs:84
2) test_absname_with_list (PathTest) \ (ExUnit.ExpectationError) expected: 'u:/foo/bar' to be equal to (==): '/foo/bar' at test/elixir/path_test.exs:96
3) test_expand_path_with_binary (PathTest) \ (ExUnit.ExpectationError) expected: "u:/foo/bar" to be equal to (==): "/foo/bar" at test/elixir/path_test.exs:118
4) test_expand_path_with_list (PathTest) \ (ExUnit.ExpectationError) expected: 'u:/foo/bar' to be equal to (==): '/foo/bar' at test/elixir/path_test.exs:134
5) test_expand_path_with_user_home (PathTest) \ (ExUnit.ExpectationError) expected: "/c/erl5.10.1/erts-5.10.1/bin;C:/elixir/bin" to be equal to (==): "u:/c/erl5.10.1/erts-5.10.1/bin;C:elixir/bin" at test/elixir/path_test.exs:105
6) test_argv (SystemTest) \ (SyntaxError) nofile:1: syntax error before: 'ERROR' stacktrace:
7) test_possible_deadlock (Kernel.CLI.CompileTest) \ (ExUnit.AssertionError) expected foo.ex to miss module Bar at test/elixir/kernel/cli_test.exs:88
8) test_getn (IOTest) \ (ExUnit.ExpectationError) expected: "\n" to be equal to (==): "\r" at test/elixir/io_test.exs:29
9) test_rm_rf_with_symlink (FileTest.Rm) \ (ExUnit.AssertionError) Expected false to be true at test/elixir/file_test.exs:774
10) test_read! (FileTest.OpenReadWrite) \ (ExUnit.ExpectationError) expected: "FOO\r\n" to be equal to (==): "FOO\n" at test/elixir/file_test.exs:424
11) test_read_with_binary (FileTest.OpenReadWrite) \ (ExUnit.ExpectationError) expected: {:ok,"FOO\r\n"} to match pattern (=): {:ok, "FOO\n"} at test/elixir/file_test.exs:410
12) test_read_with_list (FileTest.OpenReadWrite) \ (ExUnit.ExpectationError) expected: {:ok,"FOO\r\n"} to match pattern (=): {:ok, "FOO\n"} at test/elixir/file_test.exs:415
13) test_read_with_utf8 (FileTest.OpenReadWrite) \ (ExUnit.ExpectationError) expected: {:ok,"╨а╤Г╤Б╤Б╨║╨╕╨╣\r\nцЧе\r\n"} to match pattern (=): {:ok, "╨а╤Г╤Б╤Б╨║╨╕╨╣\nцЧе\n"} at test/elixir/file_test.exs:420
14) test_cp_with_conflict (FileTest.Cp) \ (ExUnit.ExpectationError) expected: "FOO\r\n" to be equal to (==): "FOO\n" at test/elixir/file_test.exs:71
15) test_copy (FileTest) \ (ExUnit.ExpectationError) expected: {:ok,5} to be equal to (==): {:ok,4} at test/elixir/file_test.exs:975
16) test_copy! (FileTest) \ (ExUnit.ExpectationError) expected: 5 to be equal to (==): 4 at test/elixir/file_test.exs:1005
Finished in 73.9 seconds (20.1s on load, 53.8s on tests) 1091 tests, 16 failures make: *\ [test_kernel] Error 1
Odd that you get more errors... That will be something we will have to look in to.
Anyway, I have created the following subroutine:
defp strip_drive_letter_if_windows(path) do
{os,_subtype} = :os.type
IO.inspect path
if (:win32==os) && String.at(path,1) == ":" do
String.slice(path,2,1500)
else
path
end
end
When I apply it, it works on some, but not on others; this has probably something todo with a binary <-> list mismatch?
This is the example function
test :absname_with_list do
assert (Path.absname('/foo/bar') |> strip_drive_letter_if_windows) == '/foo/bar'
assert (Path.absname('/foo/bar/') |> strip_drive_letter_if_windows) == '/foo/bar'
assert (Path.absname('/foo/bar/.') |> strip_drive_letter_if_windows) == '/foo/bar/.'
assert (Path.absname('/foo/bar/../bar') |> strip_drive_letter_if_windows) == '/foo/bar/../bar'
end
And this is the output:
1) test_absname_with_list (PathTest)
** (FunctionClauseError) no function clause matching in String.Unicode.next_grapheme/1
stacktrace:
priv/unicode.ex:171: String.Unicode.next_grapheme('c:/foo/bar')
lib/string.ex:652: String.at/2
test/elixir/path_test.exs:257: PathTest.strip_drive_letter_if_windows/1
test/elixir/path_test.exs:96: PathTest.test_absname_with_list/1
@ToJans that's because if Path.absname/1
receives a char list (single quotes) and String.split/2
just works with binary (double quotes). Please try this implementation instead:
if match? { :win32, _ }, :os.type do
defp strip_drive_letter_if_windows([_d,?:|rest]), do: rest
defp strip_drive_letter_if_windows(<<_d,?:,rest::binary>>), do: rest
else
defp strip_drive_letter_if_windows(path), do : path
end
Btw, I haven't checked the implementation above, so it may have bugs :P
I think the extra errors @AlbertMoscow gets are all related to the fact that it expects \r\n
and that it only finds a \n
.
This is probably due to the git autocrlf config on his machine. The safest would probably be to use a function similar to strip_drive_letter_if_windows
which replaces all \r\n
with \r
?
@ToJans A better solution may be to just stop writing new lines in those tests. I bet many of them are using IO.puts
and we could just swap for IO.write
. :)
The problem is in the 2 files under fixtures
: file.txt
and utf8.txt
.
I tried removing the \r
everywhere, but this breaks a lot of the io_tests
as well. I wonder if it is possible to just write those 2 files to disk in the setup of the test. AFAIK that would fix it?
The issue with writing in the test setup is that we can race conditions in between the tests now because they may try to write to the same file. :( Let me give a quick try on something else.
@ToJans maybe we can setup a .gitattributes
file to avoid clrf conversion? What do you think?
Sounds like a plan... I'll take a look if we can restrict it to the fixtures folder, or do you think that is not necessary?
Restricting it to the fixtures folder sounds like a good plan. :)
@AlbertMoscow Could you give it another try please? Thanks!
@AlbertMoscow you may need to refetch the repository from scratch or wipe out your git cache :)
Good news! There are 4 failures left on Windows. But do care about errors during tests? I believe it's much worse than just a test failure... At least we must consider there are about 4 or 5 extra test failures:
That is good news. Regarding the tests failing and errors:
I am not sure what the expected behavior should be, f.e. I would assume to value it should be equal to should all start with C:/folder
instead of C:folder
?. Also, apparently we need to loose the drive prefix from the expected value.
I have taken a look, but I have no idea what the intent is here? system_test.exs
line 43
kernel/cli_test.exs
line 88: no idea what this should be(come).
file_test
line 774 : I can take a look at what is happening here, why the file does not exist...
I have no clue how to get started with this...
@ToJans unfortunately I have no idea what are the source for those test failures too. What if we do another screen sharing about those later? Unfortunately, I am busy the remaining of this week, so maybe over the weekend or next week.
I have an idea from where the errors are coming from though. They are probably happening because we are trying to execute bin/elixir
but we should execute bin/elixir.bat
on windows instead. I have pushed a fix to master that may have fixed those, could you please let me know?
I used the new code, and while some errors disappeared, some remained:
Compiled lib/ex_unit/lib/ex_unit/runner.ex
Compiled lib/ex_unit/lib/ex_unit/doc_test.ex
Compiled lib/ex_unit/lib/ex_unit/assertions.ex
==> elixir (eunit)
All 213 tests passed.
==> kernel (exunit)
................................................................................................................................................................
................................................................................................................................................................
................................................................................................................................................................
.................................................................F..................................................................................** (TokenMis
singError) nofile:1: missing terminator: ] (for "[" starting at line 1)
................................** (throw) 1
..............................................................** (SyntaxError) nofile:1: unexpected token: end
.. :erlang.system_info({:purify,'Node: nonode@nohost'})
init.erl:757: :init.do_boot/3
........................................................................................................** (ErlangError) erlang error: 1
.........................................................................................F.............................................................** (Synta
xError) nofile:1: invalid token: \x{3042}
:erlang.system_info({:purify,'Node: nonode@nohost'})
init.erl:757: :init.do_boot/3
....F..** (SyntaxError) nofile:1: invalid token: µ
:erlang.system_info({:purify,'Node: nonode@nohost'})
init.erl:757: :init.do_boot/3
............F...............................................................................................
Failures:
1) test_argv (SystemTest)
** (SyntaxError) nofile:1: syntax error before: 'ERROR'
stacktrace:
2) test_at_exit (Kernel.CLI.AtExitTest)
** (ExUnit.ExpectationError)
expected: 'goodbye '
to be equal to (==): 'goodbye cruel world with status 0\n'
at test/elixir/kernel/cli_test.exs:39
3) test_possible_deadlock (Kernel.CLI.CompileTest)
** (ExUnit.AssertionError) expected foo.ex to miss module Bar
at test/elixir/kernel/cli_test.exs:88
4) test_rm_rf_with_symlink (FileTest.Rm)
** (ExUnit.AssertionError) Expected false to be true
at test/elixir/file_test.exs:774
Finished in 8.4 seconds (5.2s on load, 3.2s on tests)
1094 tests, 4 failures
make: *** [test_kernel] Error 1
We can setup a screen sharing session next week.
Down to 3 on my machine after this pull request will be merged:
Still some errors left, but looking good; I also :+1 the new assert functionality in the test
Wow, one failure! @ToJans, I wish I could see the same result for ExDoc tool on Windows. :) https://github.com/elixir-lang/ex_doc
Thanks! FYI I sometimes get 2 failures instead of one - race conditions probably -, and still some errors.
I might take a look at ex_doc
later, but for now my next priority would probably be make test_mix
, next to finally writing some stuff myself in Elixir ;-).
If you run make test_mix
without cleaning first, you get like 80 errors or so, so there is still some fine-tuning needed here.
We seem to have a problem on windows with race conditions, some errors pop up occasionally, f.e.
:file.make_symlink
does not seem to work on my machine... This might be a bug in the Erlang VM?
Proof:
And yes, I run on windows 7
Interesting. Yeah, it might be a bug.
@AlbertMoscow could you check whether it works on your machine, i.e. run the commands in iex after creating a folder tolink
?
@ToJans, sure! It says :enotsup
BTW, what all these :enotsup, :eio etc. mean?
: exeception=not supported I assume... Which would imply whe can skip this test on windows.
Windows does not support symlinks. So it's no surprise :file.make_symlink
does not work in cmd.exe
. However, I though it would work in Mingw.
Does Mingw run a cygwin shell? Does the shell command ln -s <source_file> <link_name>
work for you?
Windows has symlinking capability via the command line tool mklink
. It has had this since Vista and in lesser forms previously. Mklink
supports soft and hard links, directory links, and directory junctions.
Silly me... Here:
I run it on Windows XP SP3.
I can't belive my eyes! Where are all errors in kernel module? But there are still 8 failures in mix module to fix though:
@AlbertMoscow The errors were supposed to happen, but due to one reason or another the beam vm on windows does not capture stderr
when launching, so we added some functionality to redirect stderr
to stdio
when invoking the elixir shell...
The mix thing is something we are aware off... I will not have access to a laptop in the next few weeks, but after that we can try to get the error count down to 0.
If somebody else feels like fixing them, it should not be to hard, as most of them are about the \r\n
vs \n
, so feel free to take on the challenge!
@ToJans, thank you for the answer! :)
seems to me that this failure
1) test_expand_path_with_user_home (PathTest)
** (ExUnit.ExpectationError)
expected: "C:\\Users\\user"
to be equal to (==): "c:/Users/user"
at test/elixir/path_test.exs:105
can be fixed (here https://github.com/elixir-lang/elixir/blob/master/lib/elixir/test/elixir/path_test.exs#L103 ) like:
iex(5)> Path.absname(System.user_home!)
"c:/Users/user"
iex(1)> System.user_home!
"C:\\Users\\user"
iex(2)> Path.expand("~")
"c:/Users/user"
already tested it to work, though you may choose to "fix" it differently
why am i getting errors in different locations from running the same test command consecutively? like:
mingw32-make test_kernel
result is: the first failure varies between these:
1) test_path (Kernel.CLI.OptionParsingTest)
** (TokenMissingError) nofile:78: missing terminator: ' (for string s
tarting at line 78)
stacktrace:
1) test_at_exit (Kernel.CLI.AtExitTest)
** (ExUnit.ExpectationError)
expected: 'goodbye '
to be equal to (==): 'goodbye cruel world with status 0\n'
at test/elixir/kernel/cli_test.exs:39
1) test_path (Kernel.CLI.OptionParsingTest)
** (Protocol.UndefinedError) protocol Enumerable not implemented for
nil
at test/elixir/kernel/cli_test.exs:25
sometimes they are both (2 of the above) present like so:
1) test_at_exit (Kernel.CLI.AtExitTest)
** (ExUnit.ExpectationError)
expected: 'goodbye '
to be equal to (==): 'goodbye cruel world with status 0\n'
at test/elixir/kernel/cli_test.exs:39
2) test_path (Kernel.CLI.OptionParsingTest)
** (Protocol.UndefinedError) protocol Enumerable not implemented for
nil
at test/elixir/kernel/cli_test.exs:25
the last one in the list of failures however is always this:
3) test_rm_rf (FileTest.Rm)
** (MatchError) no match of right hand side value: {:error, {:error,
{:error, :eperm}, "s:/workspace.elixir.2013/elixir/lib/elixir/test/tmp/tmp
/link"}, "s:/workspace.elixir.2013/elixir/lib/elixir/test/tmp/tmp"}
at test/elixir/file_test.exs:758
(though the 3)
may be 2)
)
So i only noticed this because, I got this error at first
Failures:
1) test_argv (SystemTest)
** (ExUnit.ExpectationError)
expected: nil
to be equal to (==): ["-o", "opt", "arg1", "arg2", "--long-opt", "1
0"]
at test/elixir/system_test.exs:46
2) test_at_exit (Kernel.CLI.AtExitTest)
** (ExUnit.ExpectationError)
expected: 'goodbye '
to be equal to (==): 'goodbye cruel world with status 0\n'
at test/elixir/kernel/cli_test.exs:39
3) test_path (Kernel.CLI.OptionParsingTest)
** (Protocol.UndefinedError) protocol Enumerable not implemented for
nil
at test/elixir/kernel/cli_test.exs:25
4) test_rm_rf (FileTest.Rm)
** (MatchError) no match of right hand side value: {:error, {:error,
{:error, :eperm}, "s:/workspace.elixir.2013/elixir/lib/elixir/test/tmp/tmp
/link"}, "s:/workspace.elixir.2013/elixir/lib/elixir/test/tmp/tmp"}
at test/elixir/file_test.exs:758
the 1)
error, which I was trying to track down and it disappeared without me doing any changes and to check i restored the system_test.exs
file which was the only one I changed (when I added a bunch of IO.puts
) by using git checkout
so, I don't understand why they vary... (not to mention why did my 1)
test fail twice but not anymore later on)
and I can see the first F
in the list of dots changing its location (and sometimes one more appears nearby)
I just tested it again and only that FileTest.Rm
error appeared, so there's the case of those errors not happening at all! Makes me wonder if it's something with parallel execution of tests?(if that's even the case) i don't know
and the very next test poped 2 more errors (without me changing a thing!)
Failures:
1) test_argv (SystemTest)
** (ExUnit.ExpectationError)
expected: nil
to be equal to (==): ["-o", "opt", "arg1", "arg2", "--long-opt", "1
0"]
at test/elixir/system_test.exs:46
2) test_at_exit (Kernel.CLI.AtExitTest)
** (ExUnit.ExpectationError)
expected: 'goodbye '
to be equal to (==): 'goodbye cruel world with status 0\n'
at test/elixir/kernel/cli_test.exs:39
3) test_rm_rf (FileTest.Rm)
** (MatchError) no match of right hand side value: {:error, {:error,
{:error, :eperm}, "s:/workspace.elixir.2013/elixir/lib/elixir/test/tmp/tmp
/link"}, "s:/workspace.elixir.2013/elixir/lib/elixir/test/tmp/tmp"}
at test/elixir/file_test.exs:758
what teh....
right, now I see that was mentioned above: https://github.com/elixir-lang/elixir/issues/1280#issuecomment-19902022
I just realized that the parallel execution of tests happens because of use ExUnit.Case, async: true
(well, still reading that intro doc xD ie. http://elixir-lang.org/getting_started/6.html )
EDIT: at first sight looks like there's a test that changes current dir and thus another test executing elixir would fail because it uses relative paths
defp executable_path(name) do
Path.expand("../../../../../bin/#{name}#{executable_extension}", __FILE__)
end
EDIT2: is there a way to mark a certain test to be executed synchronously while all others can go async (when async: true
), basically I want some test that changes current dir (to temporary folder) to be executed synchronously... or maybe find a better way to executable elixir other than relative paths?
But Maybe the current dir doesn't change for all tests? or it's isolated, not sure yet
EDIT3: yep that cd is isolated
cd!(path, function)
Changes the current directory to the given path, executes the given function and then revert back to the previous path regardless if there is an exception.
Raises an error if retrieving or changing the current directory fails.
For future reference, there are some errors in the kernel module tests:
I think the problem with the stdout/race conditions on exit might be due to the implementation of :os.cmd
; I will see if I can spike a version using ports.
:+1:
EDIT: I just wanna note that I'm piping the output through this utility called wac
from here: https://github.com/aslakhellesoy/wac
to enable colors, since latest master seems to have colors on (as you see in previous screenshot from ToJans) those escape sequences.
EDIT2: and so it looks like this:
I'm basically using a make.bat
which has this inside:
EDIT5 27 july 2013 2:48am changed to avoid stderr/stdout mangling: mingw32-make %* | wac
mingw32-make %* 2>&1 | wac
EDIT3: however I've no solution yet for sublimetext2's output (when Ctrl+B is pressed) EDIT4: I modified the sublime plugin to execute a different batch file, which pipes elixir.bat through wac but sublime3 still won't show the colors but at least I don't see the escape codes
Looks like I've got new test errors on Windows after the fix for #1495 (not sure where I should've reported this, here or there) (while there are still no test errors on Linux Mint, as I've just tested)
they look like this:
109) test_touch_with_no_file (FileTest)
** (RuntimeError) expected ExUnit callback in FileCase to return :ok or { :ok, keywords }, go
t {:error, {:error, {:error, {:error, :eperm}, "s:/workspace.elixir.2013/elixir/lib/elixir/tmp/tmp/
from"}, "s:/workspace.elixir.2013/elixir/lib/elixir/tmp/tmp"}, "s:/workspace.elixir.2013/elixir/lib
/elixir/tmp"} instead
stacktrace:
test/elixir/file_test.exs:22: FileTest.__ex_unit__/2
110) test_touch_with_success! (FileTest)
** (RuntimeError) expected ExUnit callback in FileCase to return :ok or { :ok, keywords }, go
t {:error, {:error, {:error, {:error, :eperm}, "s:/workspace.elixir.2013/elixir/lib/elixir/tmp/tmp/
from"}, "s:/workspace.elixir.2013/elixir/lib/elixir/tmp/tmp"}, "s:/workspace.elixir.2013/elixir/lib
/elixir/tmp"} instead
stacktrace:
test/elixir/file_test.exs:22: FileTest.__ex_unit__/2
111) test_touch_with_timestamp (FileTest)
** (RuntimeError) expected ExUnit callback in FileCase to return :ok or { :ok, keywords }, go
t {:error, {:error, {:error, {:error, :eperm}, "s:/workspace.elixir.2013/elixir/lib/elixir/tmp/tmp/
from"}, "s:/workspace.elixir.2013/elixir/lib/elixir/tmp/tmp"}, "s:/workspace.elixir.2013/elixir/lib
/elixir/tmp"} instead
stacktrace:
test/elixir/file_test.exs:22: FileTest.__ex_unit__/2
My bad, those should be fixed on master now.
Cool! Thanks1
I notice this error:
........F...FFFFF............'MIX_ENV' is not recognized as an internal or external command,
operable program or batch file.
Not sure how to fix it myself(is it acting like a SET
aka export
or as a set and run in one cmd, not sure), but it's from here:
https://github.com/elixir-lang/elixir/blob/master/lib/mix/test/mix/cli_test.exs#L8
EDIT: ok I'm fixing this...EDIT3:fixed
EDIT2: https://github.com/elixir-lang/elixir/pull/1501
Progress!!
:+1: awesome! btw, update to master, that MIX_ENV should be fixed ( EDIT: just making sure you don't do extra dup work :) )
Never mind; put back the old code, and got the same results after a few runs.... Race conditions are :facepunch:
I'll take a look if you give up(or take a break) ... ?
@ToJans for those tests that are failing, can you try passing a :init.stop()
and check if it solves the issue? For example:
test :argv do
list = elixir('-e "IO.inspect System.argv" -e ":init.stop" -- -o opt arg1 arg2 --long-opt 10')
{ args, _ } = Code.eval_string list, []
assert args == ["-o", "opt", "arg1", "arg2", "--long-opt", "10"]
end
@josevalim Tried, it does not help/work...
@AtKaaZ Go ahead.. it is all yours!
Down to 8 errors...