From 9e835fe5a4f8b266082869fc4c0b218c8eec75fd Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 30 Nov 2021 10:19:23 +0100 Subject: tst_BenchlibCallgrind: fix x86 preprocessor check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its twoHundredMillionInstructions() test has #if-ery to limit it to gcc and x86; however, it was testing only __i386 for the x86 part, where gcc defines __x86_64 instead on modern 64-bit systems. In the process, invert the condition and the branches it controls - positive tests are easier to comprehend. Change-Id: I8e906c606c48aa5034e02e3ed5d042fbb1f2ecbc Reviewed-by: MÃ¥rten Nordheim --- .../testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/testlib') diff --git a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp index bd3a27ec24..db3e4123fb 100644 --- a/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp +++ b/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -62,9 +62,7 @@ void tst_BenchlibCallgrind::failInChildProcess() void tst_BenchlibCallgrind::twoHundredMillionInstructions() { -#if !defined(__GNUC__) || !defined(__i386) - QSKIP("This test is only defined for gcc and x86."); -#else +#if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) QBENCHMARK { __asm__ __volatile__( "mov $100000000,%%eax \n" @@ -76,6 +74,8 @@ void tst_BenchlibCallgrind::twoHundredMillionInstructions() : /* clobber */ "eax" ); } +#else + QSKIP("This test is only implemented for gcc on x86."); #endif } -- cgit v1.2.3