From 4e1213c0054fe415240a4790adfe0c3b9a456888 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 17 Oct 2023 17:16:47 +0200 Subject: [PATCH] use less heavy code in executor tests --- test/testprocessexecutor.cpp | 14 +++++++------- test/testsingleexecutor.cpp | 12 ++++++------ test/testthreadexecutor.cpp | 14 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/test/testprocessexecutor.cpp b/test/testprocessexecutor.cpp index 0bcfb447ef9..2d3450a2058 100644 --- a/test/testprocessexecutor.cpp +++ b/test/testprocessexecutor.cpp @@ -161,7 +161,7 @@ class TestProcessExecutorBase : public TestFixture { oss << "int main()\n" << "{\n"; for (int i = 0; i < 500; i++) - oss << " {char *a = malloc(10);}\n"; + oss << " {int i = *((int*)0);}\n"; oss << " return 0;\n" << "}\n"; @@ -173,7 +173,7 @@ class TestProcessExecutorBase : public TestFixture { check(16, 100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}"); } @@ -184,7 +184,7 @@ class TestProcessExecutorBase : public TestFixture { check(16, 100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY)); } @@ -196,7 +196,7 @@ class TestProcessExecutorBase : public TestFixture { check(16, 100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.plistOutput = plistOutput.c_str())); } @@ -229,7 +229,7 @@ class TestProcessExecutorBase : public TestFixture { check(2, 1, 1, "int main()\n" "{\n" - " {char *a = malloc(10);}\n" + " {int i = *((int*)0);}\n" " return 0;\n" "}"); } @@ -238,7 +238,7 @@ class TestProcessExecutorBase : public TestFixture { check(2, 20, 20, "int main()\n" "{\n" - " {char *a = malloc(10);}\n" + " {int i = *((int*)0);}\n" " return 0;\n" "}"); } @@ -256,7 +256,7 @@ class TestProcessExecutorBase : public TestFixture { check(2, 4, 2, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, diff --git a/test/testsingleexecutor.cpp b/test/testsingleexecutor.cpp index 054e8a5472b..b212c916b7b 100644 --- a/test/testsingleexecutor.cpp +++ b/test/testsingleexecutor.cpp @@ -163,7 +163,7 @@ class TestSingleExecutorBase : public TestFixture { check(100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.quiet = false)); @@ -180,7 +180,7 @@ class TestSingleExecutorBase : public TestFixture { check(100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY)); } @@ -192,7 +192,7 @@ class TestSingleExecutorBase : public TestFixture { check(100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.plistOutput = plistOutput.c_str())); } @@ -225,7 +225,7 @@ class TestSingleExecutorBase : public TestFixture { check(1, 1, "int main()\n" "{\n" - " {char *a = malloc(10);}\n" + " {int i = *((int*)0);}\n" " return 0;\n" "}"); } @@ -234,7 +234,7 @@ class TestSingleExecutorBase : public TestFixture { check(20, 20, "int main()\n" "{\n" - " {char *a = malloc(10);}\n" + " {int i = *((int*)0);}\n" " return 0;\n" "}"); } @@ -252,7 +252,7 @@ class TestSingleExecutorBase : public TestFixture { check(4, 2, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, diff --git a/test/testthreadexecutor.cpp b/test/testthreadexecutor.cpp index c37223b26ce..170cfe118ac 100644 --- a/test/testthreadexecutor.cpp +++ b/test/testthreadexecutor.cpp @@ -160,7 +160,7 @@ class TestThreadExecutorBase : public TestFixture { oss << "int main()\n" << "{\n"; for (int i = 0; i < 500; i++) - oss << " {char *a = malloc(10);}\n"; + oss << " {int i = *((int*)0);}\n"; oss << " return 0;\n" << "}\n"; @@ -172,7 +172,7 @@ class TestThreadExecutorBase : public TestFixture { check(16, 100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}"); } @@ -183,7 +183,7 @@ class TestThreadExecutorBase : public TestFixture { check(16, 100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY)); } @@ -195,7 +195,7 @@ class TestThreadExecutorBase : public TestFixture { check(16, 100, 100, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions, $.plistOutput = plistOutput.c_str())); } @@ -228,7 +228,7 @@ class TestThreadExecutorBase : public TestFixture { check(2, 1, 1, "int main()\n" "{\n" - " {char *a = malloc(10);}\n" + " {int i = *((int*)0);}\n" " return 0;\n" "}"); } @@ -237,7 +237,7 @@ class TestThreadExecutorBase : public TestFixture { check(2, 20, 20, "int main()\n" "{\n" - " {char *a = malloc(10);}\n" + " {int i = *((int*)0);}\n" " return 0;\n" "}"); } @@ -255,7 +255,7 @@ class TestThreadExecutorBase : public TestFixture { check(2, 4, 2, "int main()\n" "{\n" - " char *a = malloc(10);\n" + " int i = *((int*)0);\n" " return 0;\n" "}", dinit(CheckOptions,