fix test for mac

This commit is contained in:
MITSUNARI Shigeo 2020-05-10 14:20:11 +09:00
parent a7d10a1e4a
commit 2f6d9e3450
3 changed files with 39 additions and 9 deletions

View File

@ -1,10 +1,12 @@
TARGET = test quantize bf toyvm test_util memfunc static_buf jmp_table
XBYAK_INC=../xbyak/xbyak.h XBYAK_INC=../xbyak/xbyak.h
BOOST_EXIST=$(shell echo "\#include <boost/spirit/core.hpp>" | (gcc -E - 2>/dev/null) | grep "boost/spirit/core.hpp" >/dev/null && echo "1") BOOST_EXIST=$(shell echo "\#include <boost/spirit/core.hpp>" | (gcc -E - 2>/dev/null) | grep "boost/spirit/core.hpp" >/dev/null && echo "1")
UNAME_M=$(shell uname -m) UNAME_M=$(shell uname -m)
ONLY_64BIT=0
ifeq ($(shell uname -s),Darwin) ifeq ($(shell uname -s),Darwin)
ONLY_64BIT=1
OS=mac
ifeq ($(UNAME_M),x86_64) ifeq ($(UNAME_M),x86_64)
BIT=64 BIT=64
endif endif
@ -27,19 +29,27 @@ else
endif endif
ifeq ($(BIT),64) ifeq ($(BIT),64)
TARGET += test64 bf64 memfunc64 test_util64 static_buf64 jmp_table64 TARGET += test64 bf64 memfunc64 test_util64 jmp_table64
ifeq ($(BOOST_EXIST),1) ifeq ($(BOOST_EXIST),1)
TARGET += calc64 #calc2_64 TARGET += calc64 #calc2_64
endif endif
endif endif
ifneq ($(OS),mac)
TARGET += static_buf64
endif
ifneq ($(ONLY_64BIT),1)
TARGET += test quantize bf toyvm test_util memfunc static_buf jmp_table
ifeq ($(BOOST_EXIST),1) ifeq ($(BOOST_EXIST),1)
TARGET += calc #calc2 TARGET += calc #calc2
endif
endif endif
all: $(TARGET) all: $(TARGET)
CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -pedantic CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith #-pedantic
CFLAGS=-g -O2 -fomit-frame-pointer -Wall -I../ $(CFLAGS_WARN) CFLAGS=-g -O2 -fomit-frame-pointer -Wall -I../ $(CFLAGS_WARN)

View File

@ -1,9 +1,18 @@
TARGET = make_nm normalize_prefix jmp address bad_address misc cvt_test cvt_test32 TARGET = make_nm normalize_prefix bad_address misc cvt_test cvt_test32
XBYAK_INC=../xbyak/xbyak.h XBYAK_INC=../xbyak/xbyak.h
UNAME_S=$(shell uname -s)
BIT=32 BIT=32
ifeq ($(shell uname -m),x86_64) ifeq ($(shell uname -m),x86_64)
BIT=64 BIT=64
endif endif
ONLY_64BIT=0
ifeq ($(UNAME_S),Darwin)
# 32-bit binary is not supported
ONLY_64BIT=1
endif
ifeq ($(ONLY_64BIT),0)
TARGET += jmp address
endif
ifeq ($(BIT),64) ifeq ($(BIT),64)
TARGET += jmp64 address64 TARGET += jmp64 address64
@ -37,17 +46,19 @@ cvt_test: cvt_test.cpp ../xbyak/xbyak.h
cvt_test32: cvt_test.cpp ../xbyak/xbyak.h cvt_test32: cvt_test.cpp ../xbyak/xbyak.h
$(CXX) $(CFLAGS) $< -o $@ -DXBYAK32 $(CXX) $(CFLAGS) $< -o $@ -DXBYAK32
test_nm: normalize_prefix jmp bad_address $(TARGET) test_nm: normalize_prefix $(TARGET)
$(MAKE) -C ../gen $(MAKE) -C ../gen
ifneq ($(ONLY_64BIT),1)
./test_nm.sh ./test_nm.sh
./test_nm.sh Y ./test_nm.sh Y
./test_nm.sh avx512 ./test_nm.sh avx512
./test_address.sh ./test_address.sh
./jmp ./jmp
./cvt_test32
endif
./bad_address ./bad_address
./misc ./misc
./cvt_test ./cvt_test
./cvt_test32
ifeq ($(BIT),64) ifeq ($(BIT),64)
./test_address.sh 64 ./test_address.sh 64
./test_nm.sh 64 ./test_nm.sh 64
@ -56,8 +67,10 @@ ifeq ($(BIT),64)
endif endif
test_avx: normalize_prefix test_avx: normalize_prefix
ifneq ($(ONLY_64BIT),0)
./test_avx.sh ./test_avx.sh
./test_avx.sh Y ./test_avx.sh Y
endif
ifeq ($(BIT),64) ifeq ($(BIT),64)
./test_address.sh 64 ./test_address.sh 64
./test_avx.sh 64 ./test_avx.sh 64
@ -65,7 +78,9 @@ ifeq ($(BIT),64)
endif endif
test_avx512: normalize_prefix test_avx512: normalize_prefix
ifneq ($(ONLY_64BIT),0)
./test_avx512.sh ./test_avx512.sh
endif
ifeq ($(BIT),64) ifeq ($(BIT),64)
./test_avx512.sh 64 ./test_avx512.sh 64
endif endif

View File

@ -428,6 +428,7 @@ CYBOZU_TEST_AUTO(test4)
} }
} }
#ifndef __APPLE__
CYBOZU_TEST_AUTO(test5) CYBOZU_TEST_AUTO(test5)
{ {
struct Test5 : Xbyak::CodeGenerator { struct Test5 : Xbyak::CodeGenerator {
@ -475,6 +476,7 @@ CYBOZU_TEST_AUTO(test5)
gm.assign((const char*)gc.getCode(), gc.getSize()); gm.assign((const char*)gc.getCode(), gc.getSize());
CYBOZU_TEST_EQUAL(fm, gm); CYBOZU_TEST_EQUAL(fm, gm);
} }
#endif
size_t getValue(const uint8* p) size_t getValue(const uint8* p)
{ {
@ -1217,11 +1219,11 @@ CYBOZU_TEST_AUTO(rip_jmp)
CYBOZU_TEST_EQUAL(ret, ret1234() + ret9999()); CYBOZU_TEST_EQUAL(ret, ret1234() + ret9999());
} }
#ifdef XBYAK64_GCC #if 0
CYBOZU_TEST_AUTO(rip_addr) CYBOZU_TEST_AUTO(rip_addr)
{ {
/* /*
assume |&x - &code| < 2GiB we can't assume |&x - &code| < 2GiB anymore
*/ */
static int x = 5; static int x = 5;
struct Code : Xbyak::CodeGenerator { struct Code : Xbyak::CodeGenerator {
@ -1236,6 +1238,8 @@ CYBOZU_TEST_AUTO(rip_addr)
CYBOZU_TEST_EQUAL(x, 123); CYBOZU_TEST_EQUAL(x, 123);
} }
#endif #endif
#ifndef __APPLE__
CYBOZU_TEST_AUTO(rip_addr_with_fixed_buf) CYBOZU_TEST_AUTO(rip_addr_with_fixed_buf)
{ {
MIE_ALIGN(4096) static char buf[8192]; MIE_ALIGN(4096) static char buf[8192];
@ -1260,6 +1264,7 @@ CYBOZU_TEST_AUTO(rip_addr_with_fixed_buf)
code.setProtectModeRW(); code.setProtectModeRW();
} }
#endif #endif
#endif
struct ReleaseTestCode : Xbyak::CodeGenerator { struct ReleaseTestCode : Xbyak::CodeGenerator {
ReleaseTestCode(Label& L1, Label& L2, Label& L3) ReleaseTestCode(Label& L1, Label& L2, Label& L3)