From 7c4cc01f7900f66be8bc939ddb4fb15636f598f1 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 30 Apr 2019 17:38:01 +0200 Subject: [PATCH] Work around missing tac command on macOS in PGO run-make test. --- src/test/run-make-fulldeps/pgo-use/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/run-make-fulldeps/pgo-use/Makefile b/src/test/run-make-fulldeps/pgo-use/Makefile index ac61c97dfc5..ababd45d33e 100644 --- a/src/test/run-make-fulldeps/pgo-use/Makefile +++ b/src/test/run-make-fulldeps/pgo-use/Makefile @@ -23,6 +23,14 @@ ifdef IS_MSVC COMMON_FLAGS+= -Cpanic=abort endif +ifeq ($(UNAME),Darwin) +# macOS does not have the `tac` command, but `tail -r` does the same thing +TAC := tail -r +else +# some other platforms don't support the `-r` flag for `tail`, so use `tac` +TAC := tac +endif + all: # Compile the test program with instrumentation $(RUSTC) $(COMMON_FLAGS) -Z pgo-gen="$(TMPDIR)" main.rs @@ -40,4 +48,4 @@ all: # line with the function name before the line with the function attributes. # FileCheck only supports checking that something matches on the next line, # but not if something matches on the previous line. - tac "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt + $(TAC) "$(TMPDIR)"/main.ll | "$(LLVM_FILECHECK)" filecheck-patterns.txt