import os
import sys
-# FIXME #12303 these tests are broken on windows
-if os.name == 'nt':
- print 'ignoring make tests on windows'
- sys.exit(0)
+# msys1/msys2 automatically converts `/abs/path1:/abs/path2` into
+# `c:\real\abs\path1;c:\real\abs\path2` (semicolons) if shell thinks
+# the value is list of paths.
+# this causes great confusion and error: shell and Makefile doesn't like
+# windows paths so it is really error-prone. revert it for peace.
+def normalize_path(v):
+ # c:\path -> /c/path
+ if ':\\' in v:
+ v = '/' + v.replace(':\\', '/')
+ v = v.replace('\\', '/')
+ return v
+
+
+def putenv(name, value):
+ if os.name == 'nt':
+ value = normalize_path(value)
+ os.putenv(name, value)
+
make = sys.argv[2]
-os.putenv('RUSTC', os.path.abspath(sys.argv[3]))
-os.putenv('TMPDIR', os.path.abspath(sys.argv[4]))
-os.putenv('CC', sys.argv[5])
-os.putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
+putenv('RUSTC', os.path.abspath(sys.argv[3]))
+putenv('TMPDIR', os.path.abspath(sys.argv[4]))
+putenv('CC', sys.argv[5])
+putenv('RUSTDOC', os.path.abspath(sys.argv[6]))
filt = sys.argv[7]
ldpath = sys.argv[8]
if ldpath != '':
- os.putenv(ldpath.split('=')[0], ldpath.split('=')[1])
+ name = ldpath.split('=')[0]
+ value = ldpath.split('=')[1]
+ if os.name == 'nt' and name != 'PATH':
+ value = ":".join(normalize_path(v) for v in value.split(";"))
+ os.putenv(name, value)
if not filt in sys.argv[1]:
sys.exit(0)
print('maketest: ' + os.path.basename(os.path.dirname(sys.argv[1])))
-proc = subprocess.Popen([make, '-C', sys.argv[1]],
+path = sys.argv[1]
+if path[-1] == '/':
+ # msys1 has a bug that `make` fails to include `../tools.mk` (parent dir)
+ # if `-C path` option is given and `path` is absolute directory with
+ # trailing slash (`c:/path/to/test/`).
+ # the easist workaround is to remove the slash (`c:/path/to/test`).
+ # msys2 seems to fix this problem.
+ path = path[:-1]
+
+proc = subprocess.Popen([make, '-C', path],
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
out, err = proc.communicate()
-include ../tools.mk
+ifndef IS_WINDOWS
ifneq ($(shell uname),Darwin)
EXTRAFLAGS := -lm -lrt -ldl -lpthread
endif
+endif
-# FIXME
+# FIXME: ignore freebsd
ifneq ($(shell uname),FreeBSD)
all:
$(RUSTC) foo.rs
-include ../tools.mk
-# FIXME
+# FIXME: ignore freebsd/windows
+# (windows: see `../dep-info/Makefile`)
ifneq ($(shell uname),FreeBSD)
+ifndef IS_WINDOWS
all:
$(RUSTC) --dep-info $(TMPDIR)/custom-deps-file.d --crate-type=lib lib.rs
sleep 1
all:
endif
+
+else
+all:
+
+endif
-include ../tools.mk
+# FIXME: ignore freebsd/windows
+# on windows `rustc --dep-info` produces Makefile dependency with
+# windows native paths (e.g. `c:\path\to\libfoo.a`)
+# but msys make seems to fail to recognize such paths, so test fails.
ifneq ($(shell uname),FreeBSD)
+ifndef IS_WINDOWS
all:
$(RUSTC) --dep-info --crate-type=lib lib.rs
sleep 2
all:
endif
+
+else
+all:
+
+endif
-include ../tools.mk
+ifdef IS_WINDOWS
+ EXTRAFLAGS :=
+else
ifeq ($(shell uname),Darwin)
else
ifeq ($(shell uname),FreeBSD)
EXTRAFLAGS := -lm -lrt -ldl -lpthread
endif
endif
+endif
# Apparently older versions of GCC segfault if -g is passed...
CC := $(CC:-g=)
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// FIXME #13793
+#[test]
+fn test_dummy() {
+}
# fail if an rlib was built
all:
$(RUSTC) test.rs
- rm $(TMPDIR)/libtest*.rlib
- rm $(TMPDIR)/libtest*
+ rm $(TMPDIR)/$(call RLIB_GLOB,test)
+ rm $(TMPDIR)/$(call DYLIB_GLOB,test)
$(RUSTC) --crate-type dylib test.rs
- rm $(TMPDIR)/libtest*.rlib && exit 1 || exit 0
+ rm $(TMPDIR)/$(call RLIB_GLOB,test) && exit 1 || exit 0
rm $(TMPDIR)/$(call DYLIB_GLOB,bar)
rm $(TMPDIR)/$(call STATICLIB_GLOB,bar)
$(RUSTC) foo.rs --crate-type=bin
- rm $(TMPDIR)/bar
+ rm $(TMPDIR)/$(call BIN,bar)
$(RUSTC) foo.rs --emit=asm,ir,bc,obj,link
rm $(TMPDIR)/bar.ll
rm $(TMPDIR)/bar.bc
rm $(TMPDIR)/bar.s
rm $(TMPDIR)/bar.o
- rm $(TMPDIR)/bar
+ rm $(TMPDIR)/$(call BIN,bar)
$(RUSTC) foo.rs --emit=asm,ir,bc,obj,link --crate-type=staticlib
rm $(TMPDIR)/bar.ll
rm $(TMPDIR)/bar.s
$(RUSTC) foo.rs --emit=obj -o $(TMPDIR)/foo
rm $(TMPDIR)/foo
$(RUSTC) foo.rs --emit=link -o $(TMPDIR)/foo
- rm $(TMPDIR)/foo
+ rm $(TMPDIR)/$(call BIN,foo)
$(RUSTC) foo.rs --crate-type=rlib -o $(TMPDIR)/foo
rm $(TMPDIR)/foo
$(RUSTC) foo.rs --crate-type=dylib -o $(TMPDIR)/foo
- rm $(TMPDIR)/foo
+ rm $(TMPDIR)/$(call BIN,foo) # FIXME 13794
$(RUSTC) foo.rs --crate-type=staticlib -o $(TMPDIR)/foo
rm $(TMPDIR)/foo
$(RUSTC) foo.rs --crate-type=bin -o $(TMPDIR)/foo
- rm $(TMPDIR)/foo
+ rm $(TMPDIR)/$(call BIN,foo)
mv $(TMPDIR)/bar.bc $(TMPDIR)/foo.bc
$(RUSTC) foo.rs --emit=bc,link --crate-type=rlib
cmp $(TMPDIR)/foo.bc $(TMPDIR)/bar.bc
-include ../tools.mk
+ifdef IS_WINDOWS
+# ignore windows
+RUSTC_FLAGS =
+else
# Notice the space in the end, this emulates the output of pkg-config
RUSTC_FLAGS = -C link-args="-lc "
+endif
all:
$(RUSTC) $(RUSTC_FLAGS) empty.rs
-include ../tools.mk
+# FIXME ignore windows
+ifndef IS_WINDOWS
+
all:
$(RUSTDOC) --test foo.rs
$(RUSTDOC) -w html -o $(TMPDIR)/doc foo.rs
cp verify.sh $(TMPDIR)
$(call RUN,verify.sh) $(TMPDIR)
+
+else
+all:
+
+endif
-include ../tools.mk
+# ignore windows: `ln` is actually `cp` on msys.
+ifndef IS_WINDOWS
+
all:
$(RUSTC) foo.rs
mkdir -p $(TMPDIR)/other
ln -nsf $(TMPDIR)/$(call DYLIB_GLOB,foo) $(TMPDIR)/other
$(RUSTC) bar.rs -L $(TMPDIR)/other
+
+else
+all:
+
+endif
RLIB_GLOB = lib$(1)*.rlib
STATICLIB = $(TMPDIR)/lib$(1).a
STATICLIB_GLOB = lib$(1)*.a
+BIN = $(1)
-ifeq ($(shell uname),Darwin)
+UNAME = $(shell uname)
+ifneq (,$(findstring MINGW,$(UNAME)))
+IS_WINDOWS=1
+endif
+
+ifeq ($(UNAME),Darwin)
DYLIB_GLOB = lib$(1)*.dylib
DYLIB = $(TMPDIR)/lib$(1).dylib
else
+ifdef IS_WINDOWS
+DYLIB_GLOB = $(1)*.dll
+DYLIB = $(TMPDIR)/$(1).dll
+BIN = $(1).exe
+export PATH := $(PATH):$(LD_LIBRARY_PATH)
+else
DYLIB_GLOB = lib$(1)*.so
DYLIB = $(TMPDIR)/lib$(1).so
endif
+endif
%.a: %.o
ar crus $@ $<
$(CC) -dynamiclib -Wl,-dylib -o $@ $<
%.so: %.o
$(CC) -o $@ $< -shared
+%.dll: lib%.o
+ $(CC) -o $@ $< -shared
+
$(TMPDIR)/lib%.o: %.c
$(CC) -c -o $@ $<
-include ../tools.mk
+# FIXME ignore windows
+ifndef IS_WINDOWS
+
all:
# check that we don't ICE on unicode input, issue #11178
$(RUSTC) multiple_files.rs
# correct length. issue #8706
$(RUSTC) span_length.rs
$(call RUN,span_length) "$(RUSTC)" "$(TMPDIR)"
+
+else
+all:
+
+endif
$(RUSTC) foo.rs -o $(TMPDIR)/.foo.bar
rm $(TMPDIR)/.foo.bar
$(RUSTC) foo.rs -o $(TMPDIR)/+foo+bar
- rm $(TMPDIR)/+foo+bar
+ rm $(TMPDIR)/$(call BIN,+foo+bar)