Skip to content

Use tags on windows/unix and allow failures on appveyor #7320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 8, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ test_script:
environment:
ELIXIR_ASSERT_TIMEOUT: 2000

configuration: Test

matrix:
allow_failures:
- configuration: Test
- platform: x86
- platform: x64
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
=========
[![Travis build](https://secure.travis-ci.org/elixir-lang/elixir.svg?branch=master
"Build Status")](https://travis-ci.org/elixir-lang/elixir)
[![Windows build](https://ci.appveyor.com/api/projects/status/macwuxq7aiiv61g1?svg=true)](https://ci.appveyor.com/project/josevalim/elixir)


Elixir is a dynamic, functional language designed for building scalable and maintainable applications.

Expand Down
1 change: 1 addition & 0 deletions lib/elixir/test/elixir/node_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defmodule NodeTest do

doctest Node

@tag :unix
test "start/3 and stop/0" do
assert Node.stop() == {:error, :not_found}
assert {:ok, _} = Node.start(:hello, :shortnames, 15000)
Expand Down
122 changes: 62 additions & 60 deletions lib/elixir/test/elixir/path_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,67 +36,69 @@ defmodule PathTest do
assert_raise ArgumentError, ~r/null byte/, fn -> Path.wildcard("foo\0bar") end
end

if windows?() do
describe "Windows" do
test "relative/1" do
assert Path.relative("C:/usr/local/bin") == "usr/local/bin"
assert Path.relative("C:\\usr\\local\\bin") == "usr\\local\\bin"
assert Path.relative("C:usr\\local\\bin") == "usr\\local\\bin"

assert Path.relative("/usr/local/bin") == "usr/local/bin"
assert Path.relative("usr/local/bin") == "usr/local/bin"
assert Path.relative("../usr/local/bin") == "../usr/local/bin"
end

test "relative_to/2" do
assert Path.relative_to("D:/usr/local/foo", "D:/usr/") == "local/foo"
assert Path.relative_to("D:/usr/local/foo", "d:/usr/") == "local/foo"
assert Path.relative_to("d:/usr/local/foo", "D:/usr/") == "local/foo"
assert Path.relative_to("D:/usr/local/foo", "d:/") == "usr/local/foo"
assert Path.relative_to("D:/usr/local/foo", "D:/") == "usr/local/foo"
assert Path.relative_to("D:/usr/local/foo", "d:") == "D:/usr/local/foo"
assert Path.relative_to("D:/usr/local/foo", "D:") == "D:/usr/local/foo"
end

test "type/1" do
assert Path.type("C:/usr/local/bin") == :absolute
assert Path.type('C:\\usr\\local\\bin') == :absolute
assert Path.type("C:usr\\local\\bin") == :volumerelative

assert Path.type("/usr/local/bin") == :volumerelative
assert Path.type('usr/local/bin') == :relative
assert Path.type("../usr/local/bin") == :relative
end

test "split/1" do
assert Path.split("C:\\foo\\bar") == ["c:/", "foo", "bar"]
assert Path.split("C:/foo/bar") == ["c:/", "foo", "bar"]
end
describe "Windows" do
@describetag :windows

test "relative/1" do
assert Path.relative("C:/usr/local/bin") == "usr/local/bin"
assert Path.relative("C:\\usr\\local\\bin") == "usr\\local\\bin"
assert Path.relative("C:usr\\local\\bin") == "usr\\local\\bin"

assert Path.relative("/usr/local/bin") == "usr/local/bin"
assert Path.relative("usr/local/bin") == "usr/local/bin"
assert Path.relative("../usr/local/bin") == "../usr/local/bin"
end
else
describe "Unix" do
test "relative/1" do
assert Path.relative("/usr/local/bin") == "usr/local/bin"
assert Path.relative("usr/local/bin") == "usr/local/bin"
assert Path.relative("../usr/local/bin") == "../usr/local/bin"
assert Path.relative("/") == "."
assert Path.relative('/') == "."
assert Path.relative(['/usr', ?/, "local/bin"]) == "usr/local/bin"
end

test "type/1" do
assert Path.type("/usr/local/bin") == :absolute
assert Path.type("usr/local/bin") == :relative
assert Path.type("../usr/local/bin") == :relative

assert Path.type('/usr/local/bin') == :absolute
assert Path.type('usr/local/bin') == :relative
assert Path.type('../usr/local/bin') == :relative

assert Path.type(['/usr/', 'local/bin']) == :absolute
assert Path.type(['usr/', 'local/bin']) == :relative
assert Path.type(['../usr', '/local/bin']) == :relative
end

test "relative_to/2" do
assert Path.relative_to("D:/usr/local/foo", "D:/usr/") == "local/foo"
assert Path.relative_to("D:/usr/local/foo", "d:/usr/") == "local/foo"
assert Path.relative_to("d:/usr/local/foo", "D:/usr/") == "local/foo"
assert Path.relative_to("D:/usr/local/foo", "d:/") == "usr/local/foo"
assert Path.relative_to("D:/usr/local/foo", "D:/") == "usr/local/foo"
assert Path.relative_to("D:/usr/local/foo", "d:") == "D:/usr/local/foo"
assert Path.relative_to("D:/usr/local/foo", "D:") == "D:/usr/local/foo"
end

test "type/1" do
assert Path.type("C:/usr/local/bin") == :absolute
assert Path.type('C:\\usr\\local\\bin') == :absolute
assert Path.type("C:usr\\local\\bin") == :volumerelative

assert Path.type("/usr/local/bin") == :volumerelative
assert Path.type('usr/local/bin') == :relative
assert Path.type("../usr/local/bin") == :relative
end

test "split/1" do
assert Path.split("C:\\foo\\bar") == ["c:/", "foo", "bar"]
assert Path.split("C:/foo/bar") == ["c:/", "foo", "bar"]
end
end

describe "Unix" do
@describetag :unix

test "relative/1" do
assert Path.relative("/usr/local/bin") == "usr/local/bin"
assert Path.relative("usr/local/bin") == "usr/local/bin"
assert Path.relative("../usr/local/bin") == "../usr/local/bin"
assert Path.relative("/") == "."
assert Path.relative('/') == "."
assert Path.relative(['/usr', ?/, "local/bin"]) == "usr/local/bin"
end

test "type/1" do
assert Path.type("/usr/local/bin") == :absolute
assert Path.type("usr/local/bin") == :relative
assert Path.type("../usr/local/bin") == :relative

assert Path.type('/usr/local/bin') == :absolute
assert Path.type('usr/local/bin') == :relative
assert Path.type('../usr/local/bin') == :relative

assert Path.type(['/usr/', 'local/bin']) == :absolute
assert Path.type(['usr/', 'local/bin']) == :relative
assert Path.type(['../usr', '/local/bin']) == :relative
end
end

Expand Down
22 changes: 14 additions & 8 deletions lib/elixir/test/elixir/system_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ defmodule SystemTest do
end
end

if windows?() do
test "cmd/2 win" do
describe "Windows" do
@describetag :windows

test "cmd/2" do
assert {"hello\r\n", 0} = System.cmd("cmd", ~w[/c echo hello])
end

test "cmd/3 (with options) win" do
test "cmd/3 (with options)" do
assert {["hello\r\n"], 0} =
System.cmd(
"cmd",
Expand All @@ -113,7 +115,7 @@ defmodule SystemTest do

@echo "echo-elixir-test"

test "cmd/2 with absolute and relative Windows paths" do
test "cmd/2 with absolute and relative paths" do
echo = tmp_path(@echo)
File.mkdir_p!(Path.dirname(echo))
File.cp!(System.find_executable("cmd"), echo)
Expand All @@ -132,12 +134,16 @@ defmodule SystemTest do
after
File.rm_rf!(Path.dirname(tmp_path(@echo)))
end
else
test "cmd/2 unix" do
end

describe "UNIX" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You used "Unix" once and "UNIX" the other time :)

@describetag :unix

test "cmd/2" do
assert {"hello\n", 0} = System.cmd("echo", ["hello"])
end

test "cmd/3 (with options) unix" do
test "cmd/3 (with options)" do
opts = [
into: [],
cd: System.cwd!(),
Expand All @@ -152,7 +158,7 @@ defmodule SystemTest do

@echo "echo-elixir-test"

test "cmd/2 with absolute and relative Unix paths" do
test "cmd/2 with absolute and relative paths" do
echo = tmp_path(@echo)
File.mkdir_p!(Path.dirname(echo))
File.cp!(System.find_executable("echo"), echo)
Expand Down
12 changes: 9 additions & 3 deletions lib/elixir/test/elixir/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
assert_timeout = String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT") || "500")
ExUnit.start(trace: "--trace" in System.argv(), assert_receive_timeout: assert_timeout)

# Beam files compiled on demand
path = Path.expand("../../tmp/beams", __DIR__)
File.rm_rf!(path)
Expand Down Expand Up @@ -87,3 +84,12 @@ defmodule CodeFormatterHelpers do
end
end
end

assert_timeout = String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT") || "500")
exclude = if PathHelpers.windows?(), do: [unix: true], else: [windows: true]

ExUnit.start(
trace: "--trace" in System.argv(),
assert_receive_timeout: assert_timeout,
exclude: exclude
)