From f54f7d847099db448223fd630c5416b6fbd84c9e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 1 Aug 2017 18:30:33 +0200 Subject: configure: Add a feature to write tests in the .json file We're adding a lot of unnecessary files that end up later as cargo-cult, for at most a handful of lines. So instead move the testcases directly into the .json file. The following sources were not inlined, because multiple tests share them, and the inlining infra does not support that (yet): - avx512 - openssl - gnu-libiconv/sun-libiconv (there is also a command line option to select the exact variant, which makes it hard/impossible to properly coalesce the library sources) The following sources were not inlined because of "complications": - verifyspec contains a lengthy function in the project file - stl contains lots of code in the source file - xlocalescanprint includes a private header from the source tree via a relative path, which we can't do, as the test's physical location is variable. - corewlan uses objective c++, which the inline system doesn't support reduce_relocs and reduce_exports now create libraries with main(), which is weird enough, but doesn't hurt. Done-with: Oswald Buddenhagen Change-Id: Ic3a088f9f08a4fd7ae91fffd14ce8a262021cca0 Reviewed-by: Oswald Buddenhagen --- configure.json | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 217 insertions(+), 24 deletions(-) (limited to 'configure.json') diff --git a/configure.json b/configure.json index b7f767e2ec..80278b3b69 100644 --- a/configure.json +++ b/configure.json @@ -147,7 +147,14 @@ "libraries": { "zlib": { "label": "zlib", - "test": "unix/zlib", + "test": { + "include": "zlib.h", + "main": [ + "z_streamp stream = 0;", + "(void) zlibVersion();", + "(void) compress2(0, 0, 0, 0, 1); // compress2 was added in zlib version 1.0.8" + ] + }, "sources": [ { "libs": "-lzdll", "condition": "config.msvc" }, { "libs": "-lz", "condition": "!config.msvc" } @@ -155,7 +162,17 @@ }, "dbus": { "label": "D-Bus >= 1.2", - "test": "unix/dbus", + "test": { + "include": "dbus/dbus.h", + "main": "(void) dbus_bus_get_private(DBUS_BUS_SYSTEM, (DBusError *)NULL);", + "qmake": [ + "CONFIG += build_all", + "CONFIG(debug, debug|release): \\", + " LIBS += $$LIBS_DEBUG", + "else: \\", + " LIBS += $$LIBS_RELEASE" + ] + }, "sources": [ { "type": "pkgConfig", "args": "dbus-1 >= 1.2" }, { @@ -179,7 +196,10 @@ }, "libudev": { "label": "udev", - "test": "unix/libudev", + "test": { + "include": "libudev.h", + "main": "udev_unref(udev_new());" + }, "sources": [ { "type": "pkgConfig", "args": "libudev" }, "-ludev" @@ -241,12 +261,31 @@ "c++14": { "label": "C++14 support", "type": "compile", - "test": "common/c++14" + "test": { + "head": [ + "#if __cplusplus > 201103L", + "// Compiler claims to support C++14, trust it", + "#else", + "# error __cplusplus must be > 201103L (the value of C++11)", + "#endif" + ], + "qmake": "CONFIG += c++11 c++14" + } }, "c++1z": { "label": "C++1z support", "type": "compile", - "test": "common/c++1z" + "test": { + "head": [ + "#if __cplusplus > 201402L", + "// Compiler claims to support experimental C++1z, trust it", + "#else", + "# error __cplusplus must be > 201402L (the value for C++14)", + "#endif", + "#include // https://bugs.llvm.org//show_bug.cgi?id=33117" + ], + "qmake": "CONFIG += c++11 c++14 c++1z" + } }, "precompile_header": { "label": "precompiled header support", @@ -271,12 +310,38 @@ "reduce_exports": { "label": "symbol visibility support", "type": "compile", - "test": "unix/reduce_exports" + "test": { + "head": [ + "#if defined(__GNUC__)", + "__attribute((visibility(\"default\")))", + "#elif defined(__SUNPRO_CC)", + "__global", + "#else", + "# error GCC4+ or SunStudio 8+ are required to support ELF visibility", + "#endif" + ], + "qmake": [ + "TEMPLATE = lib", + "CONFIG += dll hide_symbols", + "isEmpty(QMAKE_CFLAGS_HIDESYMS): error(\"Nope\")" + ] + } }, "reduce_relocations": { "label": "-Bsymbolic-functions support", "type": "compile", - "test": "unix/reduce_relocs" + "test": { + "head": [ + "#if !(defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64))", + "# error Symbolic function binding on this architecture may be broken, disabling it (see QTBUG-36129).", + "#endif" + ], + "qmake": [ + "TEMPLATE = lib", + "CONFIG += dll bsymbolic_functions", + "isEmpty(QMAKE_LFLAGS_BSYMBOLIC_FUNC): error(\"Nope\")" + ] + } }, "build_parts": { "type": "buildParts" @@ -284,47 +349,150 @@ "separate_debug_info": { "label": "separate debug information support", "type": "compile", - "test": "unix/objcopy" + "test": { + "qmake": [ + "TARGET = objcopytest", + "load(resolve_target)", + "QMAKE_POST_LINK += \\", + " $$QMAKE_OBJCOPY --only-keep-debug $$QMAKE_RESOLVED_TARGET objcopytest.debug && \\", + " $$QMAKE_OBJCOPY --strip-debug $$QMAKE_RESOLVED_TARGET && \\", + " $$QMAKE_OBJCOPY --add-gnu-debuglink=objcopytest.debug $$QMAKE_RESOLVED_TARGET" + ] + } }, "sse2": { "label": "SSE2 instructions", "type": "compile", - "test": "common/sse2" + "test": { + "include": "emmintrin.h", + "main": [ + "__m128i a = _mm_setzero_si128();", + "_mm_maskmoveu_si128(a, _mm_setzero_si128(), 0);" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_SSE2, var): error(\"This compiler does not support SSE2\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE2" + ] + } }, "sse3": { "label": "SSE3 instructions", "type": "compile", - "test": "common/sse3" + "test": { + "include": "pmmintrin.h", + "main": [ + "__m128d a = _mm_set1_pd(6.28);", + "__m128d b = _mm_set1_pd(3.14);", + "__m128d result = _mm_addsub_pd(a, b);", + "(void) _mm_movedup_pd(result);" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_SSE3, var): error(\"This compiler does not support SSE3\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE3" + ] + } }, "ssse3": { "label": "SSSE3 instructions", "type": "compile", - "test": "common/ssse3" + "test": { + "include": "tmmintrin.h", + "main": [ + "__m128i a = _mm_set1_epi32(42);", + "_mm_abs_epi8(a);", + "(void) _mm_sign_epi16(a, _mm_set1_epi32(64));" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_SSSE3, var): error(\"This compiler does not support SSSE3\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSSE3" + ] + } }, "sse4_1": { "label": "SSE4.1 instructions", "type": "compile", - "test": "common/sse4_1" + "test": { + "include": "smmintrin.h", + "main": [ + "__m128 a = _mm_setzero_ps();", + "_mm_ceil_ps(a);", + "__m128i result = _mm_mullo_epi32(_mm_set1_epi32(42), _mm_set1_epi32(64));", + "(void)result;" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_SSE4_1, var): error(\"This compiler does not support SSE4.1\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_1" + ] + } }, "sse4_2": { "label": "SSE4.2 instructions", "type": "compile", - "test": "common/sse4_2" + "test": { + "include": "nmmintrin.h", + "main": [ + "__m128i a = _mm_setzero_si128();", + "__m128i b = _mm_set1_epi32(42);", + "(void) _mm_cmpestrm(a, 16, b, 16, 0);" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_SSE4_2, var): error(\"This compiler does not support SSE4.2\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_SSE4_2" + ] + } }, "f16c": { "label": "F16C instructions", "type": "compile", - "test": "common/f16c" + "test": { + "include": "immintrin.h", + "main": [ + "__m128i a = _mm_setzero_si128();", + "__m128 b = _mm_cvtph_ps(a);", + "__m256 b256 = _mm256_cvtph_ps(a);", + "(void) _mm_cvtps_ph(b, 0);", + "(void) _mm256_cvtps_ph(b256, 0);" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_F16C, var): error(\"This compiler does not support F16C\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_F16C" + ] + } }, "avx": { "label": "AVX instructions", "type": "compile", - "test": "common/avx" + "test": { + "include": "immintrin.h", + "main": [ + "__m256d a = _mm256_setzero_pd();", + "__m256d b = _mm256_set1_pd(42.42);", + "(void) _mm256_add_pd(a, b);" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_AVX, var): error(\"This compiler does not support AVX\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX" + ] + } }, "avx2": { "label": "AVX2 instructions", "type": "compile", - "test": "common/avx2" + "test": { + "include": "immintrin.h", + "main": [ + "// AVX", + "_mm256_zeroall();", + "__m256i a = _mm256_setzero_si256();", + "// AVX2", + "__m256i b = _mm256_and_si256(a, a);", + "(void) _mm256_add_epi8(a, b);" + ], + "qmake": [ + "!defined(QMAKE_CFLAGS_AVX2, var): error(\"This compiler does not support AVX2\")", + "QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2" + ] + } }, "avx512f": { "label": "AVX512 F instructions", @@ -395,33 +563,58 @@ "type": "subarch", "subarch": "neon" }, - "posix_fallocate": { "label": "POSIX fallocate()", "type": "compile", - "test": "unix/posix_fallocate" + "test": { + "include": [ "fcntl.h", "unistd.h" ], + "main": "(void) posix_fallocate(0, 0, 0);" + } }, "alloca_stdlib_h": { "label": "alloca() in stdlib.h", "type": "compile", - "test": "common/alloca" + "test": { + "include": "stdlib.h", + "main": "alloca(1);" + } }, "alloca_h": { "label": "alloca() in alloca.h", "type": "compile", - "test": "common/alloca", - "args": "DEFINES+=USE_ALLOCA_H" + "test": { + "include": "alloca.h", + "tail": [ + "#ifdef __QNXNTO__", + "// extra include needed in QNX7 to define NULL for the alloca() macro", + "# include ", + "#endif" + ], + "main": "alloca(1);" + } }, "alloca_malloc_h": { "label": "alloca() in malloc.h", "type": "compile", - "test": "common/alloca", - "args": "DEFINES+=USE_MALLOC_H" + "test": { + "include": "malloc.h", + "main": "alloca(1);" + } }, "stack_protector": { "label": "stack protection", "type": "compile", - "test": "unix/stack-protector" + "test": { + "head": [ + "#ifdef __QNXNTO__", + "# include ", + "# if _NTO_VERSION < 700", + "# error stack-protector not used (by default) before QNX 7.0.0.", + "# endif", + "#endif" + ], + "qmake": "QMAKE_CXXFLAGS += -fstack-protector-strong" + } }, "incredibuild_xge": { "label": "IncrediBuild", -- cgit v1.2.3 From b0060d1056d6d1752d91652261de97db909c7862 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 31 Jul 2017 12:51:38 +0200 Subject: configure: un-namespace remaining non-inline configure tests only few tests remain, and many of these were mis-classified anyway. Change-Id: Ic3bc96928a0c79fe77b9ec10e6508d4822f18df2 Reviewed-by: Thiago Macieira --- configure.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'configure.json') diff --git a/configure.json b/configure.json index 80278b3b69..6221c9803a 100644 --- a/configure.json +++ b/configure.json @@ -229,7 +229,7 @@ "verifyspec": { "label": "valid makespec", "type": "verifySpec", - "test": "common/verifyspec" + "test": "verifyspec" }, "architecture": { "label": "target architecture", @@ -256,7 +256,7 @@ "stl": { "label": "STL compatibility", "type": "compile", - "test": "unix/stl" + "test": "stl" }, "c++14": { "label": "C++14 support", @@ -497,55 +497,55 @@ "avx512f": { "label": "AVX512 F instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=F" }, "avx512er": { "label": "AVX512 ER instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=ER" }, "avx512cd": { "label": "AVX512 CD instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=CD" }, "avx512pf": { "label": "AVX512 PF instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=PF" }, "avx512dq": { "label": "AVX512 DQ instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=DQ" }, "avx512bw": { "label": "AVX512 BW instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=BW" }, "avx512vl": { "label": "AVX512 VL instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=VL" }, "avx512ifma": { "label": "AVX512 IFMA instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=IFMA" }, "avx512vbmi": { "label": "AVX512 VBMI instructions", "type": "compile", - "test": "common/avx512", + "test": "avx512", "args": "AVX512=VBMI" }, "mips_dsp": { -- cgit v1.2.3