diff options
Diffstat (limited to 'debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind')
5 files changed, 134 insertions, 0 deletions
diff --git a/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp new file mode 100644 index 00000000000..a4fa5330f35 --- /dev/null +++ b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/direction.cpp @@ -0,0 +1,33 @@ +// Purpose: +// Check that \DexExpectStepKind correctly counts 'VERTICAL_BACKWARD' steps +// for a trivial test. Expect one 'VERTICAL_BACKWARD' for every step onto +// a lesser source line number in the same function. Expect one +// 'VERTICAL_FORWARD' for every step onto a greater source line number in +// the same function. +// +// REQUIRES: system-linux, lldb +// +// RUN: %dexter test --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \ +// RUN: | FileCheck %s +// CHECK: direction.cpp: + +int func(int i) { + return i; // step 7, 9, 11 +} + +int main() +{ + for (int i = 0; i < 2; ++i) { // step 1: FUNC, step 3, 5: VERTICAL_BACKWARD + i = i; // step 2, 4: VERTICAL_FORWARD + } + // ---------1 - step 6: VERTICAL_FORWARD + // ---------|---------2 - step 8: HORIZONTAL_FORWARD + // ----3----|---------| - step 10: HORIZONTAL_BACKWARD + return func(func(0) + func(1)); +} + +// DexExpectStepKind('VERTICAL_BACKWARD', 2) +// DexExpectStepKind('VERTICAL_FORWARD', 3) +// DexExpectStepKind('HORIZONTAL_FORWARD', 1) +// DexExpectStepKind('HORIZONTAL_BACKWARD', 1) diff --git a/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/func.cpp b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/func.cpp new file mode 100644 index 00000000000..46a13143c50 --- /dev/null +++ b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/func.cpp @@ -0,0 +1,25 @@ +// Purpose: +// Check that \DexExpectStepKind correctly counts 'FUNC' steps for a +// trivial test. Expect one 'FUNC' per call to a function which is defined +// in one of the source files in the test directory. +// +// REQUIRES: system-linux, lldb +// +// RUN: %dexter test --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \ +// RUN: | FileCheck %s +// CHECK: func.cpp: + +int func(int i) { + return i; +} + +int main() +{ + func(0); + func(1); + return 0; +} + +// main, func, func +// DexExpectStepKind('FUNC', 3) diff --git a/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/func_external.cpp b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/func_external.cpp new file mode 100644 index 00000000000..4ca8d1e746d --- /dev/null +++ b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/func_external.cpp @@ -0,0 +1,25 @@ +// Purpose: +// Check that \DexExpectStepKind correctly counts 'FUNC_EXTERNAL' steps +// for a trivial test. Expect one 'FUNC_EXTERNAL' per external call. +// +// REQUIRES: system-linux, lldb +// +// RUN: %dexter test --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \ +// RUN: | FileCheck %s +// CHECK: func_external.cpp: + +#include <cstdlib> + +int func(int i){ + return abs(i); +} + +int main() +{ + func(0); + func(1); + return 0; +} + +// DexExpectStepKind('FUNC_EXTERNAL', 2) diff --git a/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/recursive.cpp b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/recursive.cpp new file mode 100644 index 00000000000..dd4af84363b --- /dev/null +++ b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/recursive.cpp @@ -0,0 +1,26 @@ +// Purpose: +// Check that \DexExpectStepKind correctly handles recursive calls. +// Specifically, ensure recursive calls count towards 'FUNC' and not +// 'VERTICAL_BACKWARD'. +// +// REQUIRES: system-linux, lldb +// +// RUN: %dexter test --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \ +// RUN: | FileCheck %s +// CHECK: recursive.cpp: + +int func(int i) { + if (i > 1) + return i + func(i - 1); + return i; +} + +int main() +{ + return func(3); +} + +// main, func, func, func +// DexExpectStepKind('FUNC', 4) +// DexExpectStepKind('VERTICAL_BACKWARD', 0) diff --git a/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/small_loop.cpp b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/small_loop.cpp new file mode 100644 index 00000000000..b85aab1d848 --- /dev/null +++ b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_step_kind/small_loop.cpp @@ -0,0 +1,25 @@ +// Purpose: +// Check that \DexExpectStepKind correctly counts function calls in loops +// where the last source line in the loop is a call. Expect steps out +// of a function to a line before the call to count as 'VERTICAL_BACKWARD'. +// +// REQUIRES: system-linux, lldb +// +// RUN: %dexter test --fail-lt 1.0 -w \ +// RUN: --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \ +// RUN: | FileCheck %s +// CHECK: small_loop.cpp: + +int func(int i){ + return i; +} + +int main() +{ + for (int i = 0; i < 2; ++i) { + func(i); + } + return 0; +} + +// DexExpectStepKind('VERTICAL_BACKWARD', 2) |