Skip to content

Commit

Permalink
use ignore directives for run-make tests
Browse files Browse the repository at this point in the history
This makes the tests easier to read, and makes it possible to tell which
tests aren't being run on the host platform.

Fixes #56704.
  • Loading branch information
euclio committed Jan 7, 2019
1 parent b92552d commit 0f70c06
Show file tree
Hide file tree
Showing 44 changed files with 107 additions and 285 deletions.
7 changes: 2 additions & 5 deletions src/test/run-make-fulldeps/c-dynamic-dylib/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
-include ../tools.mk

# ignore-macos
# This hits an assertion in the linker on older versions of osx apparently
ifeq ($(shell uname),Darwin)
all:
echo ignored
else

all: $(call DYLIB,cfoo)
$(RUSTC) foo.rs -C prefer-dynamic
$(RUSTC) bar.rs
$(call RUN,bar)
$(call REMOVE_DYLIBS,cfoo)
$(call FAIL,bar)
endif
9 changes: 3 additions & 6 deletions src/test/run-make-fulldeps/c-dynamic-rlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
-include ../tools.mk

# ignore-macos
# This hits an assertion in the linker on older versions of osx apparently

# This overrides the LD_LIBRARY_PATH for RUN
TARGET_RPATH_DIR:=$(TARGET_RPATH_DIR):$(TMPDIR)

# This hits an assertion in the linker on older versions of osx apparently
ifeq ($(shell uname),Darwin)
all:
echo ignored
else
all: $(call DYLIB,cfoo)
$(RUSTC) foo.rs
$(RUSTC) bar.rs
$(call RUN,bar)
$(call REMOVE_DYLIBS,cfoo)
$(call FAIL,bar)
endif
10 changes: 3 additions & 7 deletions src/test/run-make-fulldeps/c-link-to-rust-staticlib/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
-include ../tools.mk

# FIXME: ignore freebsd
ifneq ($(shell uname),FreeBSD)
# ignore-freebsd
# FIXME

all:
$(RUSTC) foo.rs
$(CC) bar.c $(call STATICLIB,foo) $(call OUT_EXE,bar) \
$(EXTRACFLAGS) $(EXTRACXXFLAGS)
$(call RUN,bar)
rm $(call STATICLIB,foo)
$(call RUN,bar)

else
all:

endif
7 changes: 2 additions & 5 deletions src/test/run-make-fulldeps/cdylib-fewer-symbols/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@

-include ../tools.mk

# ignore-windows
# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU
# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753
ifdef IS_WINDOWS
all:
true
else

all:
$(RUSTC) foo.rs
nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_
endif
13 changes: 3 additions & 10 deletions src/test/run-make-fulldeps/compiler-rt-works-on-mingw/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
-include ../tools.mk

ifneq (,$(findstring MINGW,$(UNAME)))
ifndef IS_MSVC
# only-windows
# only-gnu

all:
$(CXX) foo.cpp -c -o $(TMPDIR)/foo.o
$(AR) crus $(TMPDIR)/libfoo.a $(TMPDIR)/foo.o
$(RUSTC) foo.rs -lfoo -lstdc++
$(call RUN,foo)
else
all:

endif
else
all:

endif
17 changes: 4 additions & 13 deletions src/test/run-make-fulldeps/dep-info-spaces/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
-include ../tools.mk

# FIXME: ignore freebsd/windows
# (windows: see `../dep-info/Makefile`)
ifneq ($(shell uname),FreeBSD)
ifndef IS_WINDOWS
# ignore-windows
# ignore-freebsd
# FIXME: (windows: see `../dep-info/Makefile`)

all:
cp lib.rs $(TMPDIR)/
cp 'foo foo.rs' $(TMPDIR)/
Expand All @@ -17,12 +17,3 @@ all:
pwd
$(MAKE) -drf Makefile.foo
rm $(TMPDIR)/done && exit 1 || exit 0
else
all:

endif

else
all:

endif
17 changes: 4 additions & 13 deletions src/test/run-make-fulldeps/dep-info/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
-include ../tools.mk

# FIXME: ignore freebsd/windows
# on windows `rustc --dep-info` produces Makefile dependency with
# ignore-windows
# ignore-freebsd
# FIXME: 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:
cp *.rs $(TMPDIR)
$(RUSTC) --emit dep-info,link --crate-type=lib $(TMPDIR)/lib.rs
Expand All @@ -23,12 +23,3 @@ all:
rm $(TMPDIR)/bar.rs
cp $(TMPDIR)/lib2.rs $(TMPDIR)/lib.rs
$(MAKE) -drf Makefile.foo
else
all:

endif

else
all:

endif
28 changes: 5 additions & 23 deletions src/test/run-make-fulldeps/emit-stack-sizes/Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
-include ../tools.mk

# ignore-windows
# ignore-macos
# min-llvm-version 6.0
#
# This feature only works when the output object format is ELF so we ignore
# macOS and Windows
ifdef IS_WINDOWS
# Do nothing on Windows.
all:
exit 0
else ifneq (,$(filter $(TARGET),i686-apple-darwin x86_64-apple-darwin))
# Do nothing on macOS.
all:
exit 0
else

# check that the .stack_sizes section is generated
# this test requires LLVM >= 6.0.0
vers = $(shell $(RUSTC) -Vv)
ifneq (,$(findstring LLVM version: 3,$(vers)))
all:
exit 0
else ifneq (,$(findstring LLVM version: 4,$(vers)))
all:
exit 0
else ifneq (,$(findstring LLVM version: 5,$(vers)))
all:
exit 0
else
all:
$(RUSTC) -C opt-level=3 -Z emit-stack-sizes --emit=obj foo.rs
size -A $(TMPDIR)/foo.o | $(CGREP) .stack_sizes
endif
endif
9 changes: 3 additions & 6 deletions src/test/run-make-fulldeps/fpic/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
-include ../tools.mk

# ignore-windows
# ignore-macos

# Test for #39529.
# `-z text` causes ld to error if there are any non-PIC sections

ifeq ($(UNAME),Darwin)
all:
else ifdef IS_WINDOWS
all:
else
all:
$(RUSTC) hello.rs -C link-args=-Wl,-z,text
endif
17 changes: 4 additions & 13 deletions src/test/run-make-fulldeps/include_bytes_deps/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
-include ../tools.mk

# FIXME: ignore freebsd/windows
# on windows `rustc --dep-info` produces Makefile dependency with
# ignore-windows
# ignore-freebsd
# FIXME: 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) --emit dep-info main.rs
$(CGREP) "input.txt" "input.bin" "input.md" < $(TMPDIR)/main.d
else
all:

endif

else
all:

endif
12 changes: 4 additions & 8 deletions src/test/run-make-fulldeps/intrinsic-unreachable/Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
-include ../tools.mk

ifndef IS_WINDOWS
# The assembly for exit-unreachable.rs should be shorter because it's missing
# (at minimum) a return instruction.
# ignore-windows
#
# Because of Windows exception handling, the code is not necessarily any shorter.
# https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466

all:
$(RUSTC) -O --emit asm exit-ret.rs
$(RUSTC) -O --emit asm exit-unreachable.rs
test `wc -l < $(TMPDIR)/exit-unreachable.s` -lt `wc -l < $(TMPDIR)/exit-ret.s`
else
# Because of Windows exception handling, the code is not necessarily any shorter.
# https://github.com/llvm-mirror/llvm/commit/64b2297786f7fd6f5fa24cdd4db0298fbf211466
all:
endif
6 changes: 2 additions & 4 deletions src/test/run-make-fulldeps/issue-24445/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
-include ../tools.mk

ifeq ($(UNAME),Linux)
# only-linux

all:
$(RUSTC) foo.rs
$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo
$(call RUN,foo)
$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo
$(call RUN,foo)
else
all:
endif
6 changes: 2 additions & 4 deletions src/test/run-make-fulldeps/issue-26006/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
-include ../tools.mk

# ignore-windows

OUT := $(TMPDIR)/out

ifndef IS_WINDOWS
all: time

time: libc
Expand All @@ -13,6 +14,3 @@ time: libc
libc:
mkdir -p $(OUT)/libc
$(RUSTC) in/libc/lib.rs --crate-name=libc -Cmetadata=foo -o $(OUT)/libc/liblibc.rlib
else
all:
endif
13 changes: 2 additions & 11 deletions src/test/run-make-fulldeps/issue-36710/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
-include ../tools.mk

ifeq (musl,$(findstring musl,$(TARGET)))
all: skip
else
all: test
endif
# ignore-musl

test: foo
all: foo
$(call RUN,foo)

skip:
echo "expected failure"

foo: foo.rs $(call NATIVE_STATICLIB,foo)
$(RUSTC) $< -lfoo $(EXTRACXXFLAGS)

$(TMPDIR)/libfoo.o: foo.cpp
$(call COMPILE_OBJ_CXX,$@,$<)

.PHONY: all test skip
6 changes: 1 addition & 5 deletions src/test/run-make-fulldeps/issue-37839/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
-include ../tools.mk

ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
# ignore stage1
all:
# ignore-stage1

else
all:
$(RUSTC) a.rs && $(RUSTC) b.rs
$(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \
--out-dir=$(TMPDIR)
endif
6 changes: 1 addition & 5 deletions src/test/run-make-fulldeps/issue-37893/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
-include ../tools.mk

ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1)
# ignore stage1
all:
# ignore-stage1

else
all:
$(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs
endif
8 changes: 2 additions & 6 deletions src/test/run-make-fulldeps/issue-51671/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
-include ../tools.mk

ifdef IS_WINDOWS
# Do nothing on MSVC.
all:
exit 0
else
# ignore-windows

all:
$(RUSTC) --emit=obj app.rs
nm $(TMPDIR)/app.o | $(CGREP) rust_begin_unwind
nm $(TMPDIR)/app.o | $(CGREP) rust_eh_personality
nm $(TMPDIR)/app.o | $(CGREP) rust_oom
endif
9 changes: 2 additions & 7 deletions src/test/run-make-fulldeps/libs-search-path/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
-include ../tools.mk

ifeq ($(if $(IS_WINDOWS),$(IS_MSVC),no),)
# only-windows
# only-gnu

all: empty.rs
cp -r $(shell cygpath -u $(shell $(RUSTC) --print sysroot)) $(TMPDIR)/sysroot
$(RUSTC) --target $(TARGET) --sysroot $(TMPDIR)/sysroot -L$(TMPDIR)/obj -Z print-link-args empty.rs | $(CGREP) 'lib\\crt2.o'
mkdir -p $(TMPDIR)/obj
mv $(TMPDIR)/sysroot/lib/rustlib/$(TARGET)/lib/crt2.o $(TMPDIR)/obj/crt2.o
$(RUSTC) --target $(TARGET) --sysroot $(TMPDIR)/sysroot -L$(TMPDIR)/obj -Z print-link-args empty.rs | $(CGREP) 'obj\\crt2.o'

else

all:

endif
5 changes: 1 addition & 4 deletions src/test/run-make-fulldeps/libs-through-symlinks/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
-include ../tools.mk

ifdef IS_WINDOWS
all:
else
# ignore-windows

NAME := $(shell $(RUSTC) --print file-names foo.rs)

Expand All @@ -11,4 +9,3 @@ all:
$(RUSTC) foo.rs -o $(TMPDIR)/outdir/$(NAME)
ln -nsf outdir/$(NAME) $(TMPDIR)
RUST_LOG=rustc_metadata::loader $(RUSTC) bar.rs
endif
Loading

0 comments on commit 0f70c06

Please sign in to comment.