Skip to content

Commit

Permalink
[Dexter] Remove false requirement of lldb for dexter regression tests…
Browse files Browse the repository at this point in the history
… on Windows

Not quite NFC because a little work was required to configure some tests to run
on Windows at all.

Before this patch on Windows:

    $ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
       Unsupported: 49
       Passed     : 23

After this patch on Windows:

    $ llvm-lit cross-project-tests\debuginfo-tests\dexter\feature-tests
       Unsupported      : 27
       Passed           : 39
       Expectedly failed:  6

There are 3 main changes here. The first is to add a few more substitutions in
cross-project-tests/lit.cfg.py so that tests need to use specific flags can
still use the dexter regression test defaults for the native platform. These
are:

     %dexter_regression_test_debugger
     %dexter_regression_test_builder
     %dexter_regression_test_cflags
     %dexter_regression_test_ldflags

Tests that now use these options and therefore can be run on Windows too
(though the second is still failing for unknown reasons):

    cross-project-tests/debuginfo-tests/dexte/feature_tests
        /subtools/clang-opt-bisect/clang-opt-bisect.cpp
        /subtools/test/source-root-dir.cpp

The second change is to remove spurious `REQUIRES: system-linux, lldb` and
`UNSUPPORTED: system-windows` directives, and make changes to lit.local.cfg
files that have the same effect. I've also added comments to the genuine
REQUIRES, UNSUPPORTED, and XFAIL directives so it's easier to understand
requirements at a glance. The most common reason for a test to not be supported
on Windows is that it uses DexLimitSteps, DexDeclareAddress, or DexCommandLine,
none of which are supported in the dbgeng driver.

There are two failures on Windows that were previously hidden, which I've
XFAILed:

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/dex_finish_test/default_conditional.cpp
        /commands/perfect/dex_finish_test/default_conditional_hit_count.cpp

And two that were easy to fix:

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/dex_finish_test/default_simple.cpp
        /commands/perfect/dex_finish_test/default_hit_count.cpp

Lastly, I've set three directories as unsupported.

    cross-project-tests/debuginfo-tests/dexter/feature_tests
        /commands/perfect/limit_steps
        /commands/perfect/dex_declare_address
        /commands/perfect/dex_declare_file

The first two are unsupported on Windows because they contains tests for the
DexLimitSteps and DexDeclareAddress commands which aren't supported in the
dbgeng driver. The third is unsupported on all platforms as the tests involve
invoking clang directly, which isn't currently a supported way of building
tests for dexter in lit (it can cause problems for cross compilers that can
target the host, as the tests use the default triple and linker, which may
be aligned for the default target, not host).

Tested on Windows and Linux.

Reviewed By: jmorse

Differential Revision: https://reviews.llvm.org/D118048
  • Loading branch information
OCHyams committed Jan 26, 2022
1 parent 04754af commit de3f815
Show file tree
Hide file tree
Showing 38 changed files with 63 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Test that when a \DexDeclareAddress never resolves to a value, it is
// counted as a missing value in any \DexExpectWatchValues.
//
// REQUIRES: system-linux
// The dbgeng driver doesn't support \DexDeclareAddress yet.
// UNSUPPORTED: system-windows
//
// RUN: not %dexter_regression_test -- %s | FileCheck %s
// CHECK: missing_dex_address.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: dbgeng
// The dbgeng driver doesn't support \DexCommandLine yet.
// UNSUPPORTED: system-windows
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: command_line.c:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that a \DexDeclareAddress value can have its value defined after
// the first reference to that value.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: address_after_ref.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// expression after the target line has been stepped on a given number of
// times.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: address_hit_count.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that a \DexDeclareAddress value can be used to compare the
// addresses of two local variables that refer to the same address.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: expression_address.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that a \DexDeclareAddress value can be used to compare two equal
// pointer variables.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: identical_address.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The dbgeng driver doesn't support DexDeclareAddress yet.
if config.is_msvc:
config.unsupported = True
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that multiple \DexDeclareAddress references that point to different
// addresses can be used within a single \DexExpectWatchValue.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: multiple_address.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that a \DexDeclareAddress value can be used to compare two pointer
// variables that have a fixed offset between them.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: offset_address.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that a \DexDeclareAddress value can be used to check the change in
// value of a variable over time, relative to its initial value.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: self_comparison.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# FIXME: These tests compile code with %clang substitution which needs to run
# natively but doesn't specify target triple (i.e. default triple is used).
config.unsupported = True
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
## Check that \DexDeclareFile's file declaration can be made relative to the
## --source-root-dir path.

# REQUIRES: lldb
# UNSUPPORTED: system-darwin

# RUN: %clang %S/../source/test.cpp -O0 -g -o %t
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// FIXME: Feature appears to be broken on Windows with dbgeng.
// XFAIL: system-windows
// Purpose:
// Test that \DexFinishTest can be used with a condition, so the test exits
// when the line referenced by \DexFinishTest is stepped on and the given
// condition (x == 5) is satisfied.
// Tests using the default controller (no \DexLimitSteps).
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: default_conditional.cpp

Expand All @@ -15,4 +15,4 @@ int main() {
}

// DexFinishTest('x', 5, on_line=ref('finish_line'))
// DexExpectWatchValue('x', 0, 1, 2, 3, 4, 5)
// DexExpectWatchValue('x', 0, 1, 2, 3, 4, 5, on_line=ref('finish_line'))
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// FIXME: Feature appears to be broken on Windows with dbgeng.
// XFAIL: system-windows
// Purpose:
// Test that \DexFinishTest can be used with a combination of a hit_count
// and a condition, so that the test exits after the line referenced
// by \DexFinishTest is stepped on while the condition (x == 2) is true a
// given number of times.
// Tests using the default controller (no \DexLimitSteps).
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: default_conditional_hit_count.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// specific number of times.
// Tests using the default controller (no \DexLimitSteps).
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: default_hit_count.cpp

Expand All @@ -15,4 +13,4 @@ int main() {
}

// DexFinishTest(on_line=ref('finish_line'), hit_count=5)
// DexExpectWatchValue('x', 0, 1, 2, 3, 4, 5)
// DexExpectWatchValue('x', 0, 1, 2, 3, 4, 5, on_line=ref('finish_line'))
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
// is stepped on.
// Tests using the default controller (no \DexLimitSteps).
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: default_simple.cpp

int main() {
int x = 0; // DexLabel('start_line')
x = 1;
int x = 0;
x = 1; // DexLabel('start_line')
x = 2; // DexLabel('finish_line')
}

// DexFinishTest(on_line=ref('finish_line'))
// DexExpectWatchValue('x', 0, 1)
// DexExpectWatchValue('x', 0, 1, from_line=ref('start_line'), to_line=ref('finish_line'))
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// condition (x == 5) is satisfied.
// Test using the conditional controller (using \DexLimitSteps).
//
// REQUIRES: system-linux
// The dbgeng driver doesn't support \DexLimitSteps yet.
// UNSUPPORTED: system-windows
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_conditional.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// given number of times.
// Test using the conditional controller (using \DexLimitSteps).
//
// REQUIRES: system-linux
// The dbgeng driver doesn't support \DexLimitSteps yet.
// UNSUPPORTED: system-windows
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_conditional_hit_count.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// specific number of times.
// Test using the conditional controller (using \DexLimitSteps).
//
// REQUIRES: system-linux
// The dbgeng driver doesn't support \DexLimitSteps yet.
// UNSUPPORTED: system-windows
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_hit_count.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// is stepped on.
// Test using the conditional controller (using \DexLimitSteps).
//
// REQUIRES: system-linux
// The dbgeng driver doesn't support \DexLimitSteps yet.
// UNSUPPORTED: system-windows
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_simple.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that \DexLimitSteps keyword argument hit_count correctly limits
// the number of times the command can trigger.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: hit_count.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Purpose:
// Check number of step lines are correctly reported in json output.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test --verbose -- %s | FileCheck %s
// CHECK: limit_steps_check_json_step_count.cpp
// CHECK: ## BEGIN ##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Check the DexLimit steps only gathers step info for 2 iterations of a
// for loop.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_expect_loop.cpp:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Purpose:
// Ensure that limited stepping breaks for all expected values.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_expect_value.cpp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
// doesn't exist. This can happen due to optimisations or label is on an
// empty line.
//
// FIXME: Windows regression tests run with dbgeng. \DexLimitSteps isn't yet
// supported with dbgeng.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_line_mismatch.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Purpose:
// Ensure that multiple overlapping \DexLimitSteps ranges do not interfere.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_overlapping_ranges.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Purpose:
// Test that LimitStep commands can exist on the same from line.
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: limit_steps_same_line_conditional.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The dbgeng driver doesn't support DexLimitSteps yet.
if config.is_msvc:
config.unsupported = True

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Test that \DexLimitSteps can be used without a condition (i.e. the
// breakpoint range is set any time from_line is stepped on).
//
// REQUIRES: system-linux
//
// RUN: %dexter_regression_test -- %s | FileCheck %s
// CHECK: unconditional.cpp

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Purpose:
// Check the `clang-opt-bisect` tool runs with typical input.
//
// REQUIRES: system-linux, lldb
//
// RUN: true
// RUN: %dexter_base clang-opt-bisect --debugger 'lldb' --builder 'clang' \
// RUN: --cflags "-O0 -g" -- %s \
// RUN: | FileCheck %s
// RUN: %dexter_base clang-opt-bisect \
// RUN: --debugger %dexter_regression_test_debugger \
// RUN: --builder %dexter_regression_test_builder \
// RUN: --cflags "%dexter_regression_test_cflags" \
// RUN: --ldflags "%dexter_regression_test_ldflags" \
// RUN: -- %s \
// RUN: | FileCheck %s
// CHECK: running pass 0
// CHECK: wrote{{.*}}per_pass_score
// CHECK: wrote{{.*}}pass-summary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
// display the address properly; if it is implemented, this test should be
// updated.
//
// REQUIRES: lldb, system-linux
// The dbgeng driver doesn't support \DexLimitSteps yet.
// UNSUPPORTED: system-windows
//
// RUN: not %dexter_regression_test -v -- %s | FileCheck %s

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
// in a \DexLimitSteps command results in a useful error message.
// Use --binary switch to trick dexter into skipping the build step.
//
// REQUIRES: system-linux
// RUN: not %dexter_base test --binary %s --debugger 'lldb' -- %s | FileCheck %s
// CHECK: parser error:{{.*}}err_limit_steps_no_values.cpp(10): expected 0 or at least 2 positional arguments
// CHECK: parser error:{{.*}}err_limit_steps_no_values.cpp(9): expected 0 or at least 2 positional arguments

// DexLimitSteps('test')
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// REQUIRES: lldb
// UNSUPPORTED: system-windows
//
// Purpose:
// Check that the optional keyword argument 'on_line' makes a \DexLabel label
// that line instead of the line the command is found on.
Expand All @@ -13,5 +10,5 @@ int main() {
return result;
}

// DexLabel('test', on_line=13)
// DexLabel('test', on_line=10)
// DexExpectWatchValue('result', '0', on_line=ref('test'))
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// REQUIRES: lldb
// Purpose:
// Check that we can use label-relative line numbers.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
// XFAIL:*
// This test started failing recently for unknown reasons.

// REQUIRES: lldb
// UNSUPPORTED: system-windows
//
// XFAIL:*
// RUN: %dexter --fail-lt 1.0 -w \
// RUN: --builder 'clang' --debugger 'lldb' \
// RUN: --cflags "-O0 -glldb -fdebug-prefix-map=%S=/changed" \
// RUN: --builder %dexter_regression_test_builder \
// RUN: --debugger %dexter_regression_test_debugger \
// RUN: --cflags "%dexter_regression_test_cflags -fdebug-prefix-map=%S=/changed" \
// RUN: --ldflags "%dexter_regression_test_ldflags" \
// RUN: --source-root-dir=%S --debugger-use-relative-paths -- %s

#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// REQUIRES: lldb
// Purpose:
// Check the `view` subtool works with typical inputs.
//
Expand Down
Loading

0 comments on commit de3f815

Please sign in to comment.