Skip to content

Commit 151815b

Browse files
committed
Port sbroot test to automated pytests
1 parent 5f1eaf4 commit 151815b

40 files changed

+745
-1286
lines changed

.gitignore

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
*.o
2-
*.a
3-
Makefile
1+
/Makefile
42
core
53
CMakeFiles/
6-
cmake_install.cmake
7-
CMakeCache.txt
8-
rc
9-
rdm
4+
/cmake_install.cmake
5+
/CMakeCache.txt
106
js
117
clangtest
128
gr
139
.gdb_history
1410
.ninja_log
15-
build.ninja
16-
rules.ninja
11+
/build.ninja
12+
/rules.ninja
1713
/.gdb_brestore
1814
/.gdb_brestore.txt
1915
/src/include/rct/rct-config.h
2016
/src/librtags.dylib
2117
/src/librtags.so
22-
.ninja_deps
23-
compile_commands.json
18+
/.ninja_deps
19+
/compile_commands.json
2420
/tests/dtlcpptest/dtlcpptest
2521
/bin/.gdb_brestore
2622
/bin/.gdb_brestore.txt

CMakeLists.txt

+3-11
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ if (RTAGS_ENABLE_DEV_OPTIONS)
3737

3838
include(CPack)
3939
else ()
40-
set(BUILD_TESTING 0 CACHE BOOL "Build testing files; requires cppunit.")
40+
set(WITH_TESTS 0 CACHE BOOL "Build testing files; requires cppunit.")
4141

42-
set(RCT_WITH_TESTS ${BUILD_TESTING})
42+
set(RCT_WITH_TESTS ${WITH_TESTS})
4343

4444
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
4545
if (CMAKE_COMPILER_IS_GNUCXX)
@@ -94,15 +94,7 @@ else ()
9494

9595
include(CTest)
9696

97-
if (BUILD_TESTING)
98-
find_package(Perl QUIET)
99-
if(PERL_FOUND)
100-
add_test(NAME SBRootTest COMMAND perl "${CMAKE_SOURCE_DIR}/tests/sbroot/sbroot_test.pl")
101-
set_property(TEST SBRootTest PROPERTY ENVIRONMENT "RTAGS_BINARY_DIR=${CMAKE_BINARY_DIR}/bin")
102-
else()
103-
message(WARNING "Perl not found! Excluding sbroot test from tests.")
104-
endif()
105-
97+
if (WITH_TESTS)
10698
find_program(PYTEST NAMES pytest py.test)
10799
if (PYTEST)
108100
add_test(NAME automated_tests COMMAND ${PYTEST} -svvv ${CMAKE_SOURCE_DIR}/tests/automated WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/automated)

configure

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ function usage ()
1212
echo " --debug Compile RTags in debug mode"
1313
echo " --release Compile RTags in release mode (default)"
1414
echo " --system-clang Don't build llvm/clang as part of RTags' build process (default)"
15-
echo " --build-tests Build tests"
15+
echo " --with-tests Enable testing and build test files"
16+
echo " --without-tests Disable testing and don't build test files"
1617
echo " --build-clang Download and build llvm/clang as part of RTags' build process"
1718
echo " --no-install Generate a build that isn't going to be installed"
1819
echo " --prefix [arg] Set install prefix to arg"
@@ -62,11 +63,11 @@ while [ -n "$1" ]; do
6263
--build-clang)
6364
BUILD=1
6465
;;
65-
--build-tests)
66-
CMAKE_ARGS="${CMAKE_ARGS} -DBUILD_TESTING=1"
66+
--with-tests)
67+
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=1"
6768
;;
6869
--without-tests)
69-
CMAKE_ARGS="${CMAKE_ARGS} -DBUILD_TESTING=0"
70+
CMAKE_ARGS="${CMAKE_ARGS} -DWITH_TESTS=0"
7071
;;
7172
--no-install)
7273
CMAKE_ARGS="${CMAKE_ARGS} -DRTAGS_NO_INSTALL=1"

scripts/gen-man-pages.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# You should have received a copy of the GNU General Public License
1919
# along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
2020
#
21-
# Description: rc, rdm and help2man need to be in the PATH environment variable.
21+
# Description: rc, rdm, help2man and sed need to be in the PATH environment variable.
2222
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
2323

2424
if [ $# -lt 1 ]; then

scripts/travis.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# - ASAN (default value is "1")
2525
declare -a CMAKE_PARAMS=("-DCMAKE_CXX_COMPILER=$CXX$COMPILER_VERSION"
2626
"-DCMAKE_C_COMPILER=$CC$COMPILER_VERSION"
27-
"-DBUILD_TESTING=1")
27+
"-DWITH_TESTS=1")
2828

2929
if [ "$ASAN" ]; then
3030
CMAKE_PARAMS+=("-DASAN=address,undefined")
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
[
2-
{
3-
"name": "follow_location",
4-
"rc-command": [ "--follow-location", "{0}/main.cpp:9:7:"],
5-
"expectation": ["{0}/main.cpp:5:17:"]
6-
}
2+
{
3+
"name": "follow_location",
4+
"rc-command": [
5+
"--follow-location",
6+
"{0}/main.cpp:9:7:"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:5:17:"
10+
]
11+
}
712
]
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
11
[
2-
{ "name": "find_references",
3-
"rc-command": [ "--references", "{0}/main.cpp:9:8"],
4-
"expectation": ["{0}/main.cpp:16:17","{0}/main.cpp:17:17","{0}/main.cpp:20:5"] },
5-
6-
{ "name": "multiple_template_parameters",
7-
"rc-command": [ "--references", "{0}/main.cpp:25:8"],
8-
"expectation": ["{0}/main.cpp:27:17","{0}/main.cpp:28:17","{0}/main.cpp:29:17",
9-
"{0}/main.cpp:30:17", "{0}/main.cpp:31:17"] }
2+
{
3+
"name": "find_references",
4+
"rc-command": [
5+
"--references",
6+
"{0}/main.cpp:9:8"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:16:17",
10+
"{0}/main.cpp:17:17",
11+
"{0}/main.cpp:20:5"
12+
]
13+
},
14+
{
15+
"name": "multiple_template_parameters",
16+
"rc-command": [
17+
"--references",
18+
"{0}/main.cpp:25:8"
19+
],
20+
"expectation": [
21+
"{0}/main.cpp:27:17",
22+
"{0}/main.cpp:28:17",
23+
"{0}/main.cpp:29:17",
24+
"{0}/main.cpp:30:17",
25+
"{0}/main.cpp:31:17"
26+
]
27+
}
1028
]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
[
2-
{ "name": "disabled_member_expression",
3-
"rc-command": [ "--references", "{0}/main.cpp:12:11"],
4-
"expectation": ["{0}/main.cpp:2:10","{0}/main.cpp:5:9"] }
2+
{
3+
"name": "disabled_member_expression",
4+
"rc-command": [
5+
"--references",
6+
"{0}/main.cpp:12:11"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:2:10",
10+
"{0}/main.cpp:5:9"
11+
]
12+
}
513
]
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
[
2-
{ "name": "multiple_template_parameters",
3-
"rc-command": [ "--references", "{0}/a.hpp:4:8"],
4-
"expectation": ["{0}/main.cpp:3:17","{0}/main.cpp:4:17","{0}/main.cpp:5:17",
5-
"{0}/a.cpp:3:17", "{0}/a.cpp:4:17"] }
2+
{
3+
"name": "multiple_template_parameters",
4+
"rc-command": [
5+
"--references",
6+
"{0}/a.hpp:4:8"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:3:17",
10+
"{0}/main.cpp:4:17",
11+
"{0}/main.cpp:5:17",
12+
"{0}/a.cpp:3:17",
13+
"{0}/a.cpp:4:17"
14+
]
15+
}
616
]
+33-24
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
[
2-
{ "name": "completion should show accessible items",
3-
4-
"rc-command": [ "--code-complete-at", "{0}/main.cpp:12:15",
5-
"--synchronous-completions"],
6-
7-
"expectation": [ " get int get() CXXMethod Foo ",
8-
" validate void validate(int) CXXMethod Foo ",
9-
" Foo Foo:: ClassDecl Foo ",
10-
" operator= Foo & operator=(const Foo &) CXXMethod Foo ",
11-
" operator= Foo & operator=(Foo &&) CXXMethod Foo ",
12-
" ~Foo void ~Foo() CXXDestructor Foo ",
13-
""] },
14-
15-
{ "name": "completion should not show not accessible/private items",
16-
17-
"rc-command": [ "--code-complete-at", "{0}/main.cpp:20:7",
18-
"--synchronous-completions"],
19-
20-
"expectation": [ " get int get() CXXMethod Foo ",
21-
" Foo Foo:: ClassDecl Foo ",
22-
" operator= Foo & operator=(const Foo &) CXXMethod Foo ",
23-
" operator= Foo & operator=(Foo &&) CXXMethod Foo ",
24-
" ~Foo void ~Foo() CXXDestructor Foo ",
25-
""] }
2+
{
3+
"name": "completion should show accessible items",
4+
"rc-command": [
5+
"--code-complete-at",
6+
"{0}/main.cpp:12:15",
7+
"--synchronous-completions"
8+
],
9+
"expectation": [
10+
" get int get() CXXMethod Foo ",
11+
" validate void validate(int) CXXMethod Foo ",
12+
" Foo Foo:: ClassDecl Foo ",
13+
" operator= Foo & operator=(const Foo &) CXXMethod Foo ",
14+
" operator= Foo & operator=(Foo &&) CXXMethod Foo ",
15+
" ~Foo void ~Foo() CXXDestructor Foo ",
16+
""
17+
]
18+
},
19+
{
20+
"name": "completion should not show not accessible/private items",
21+
"rc-command": [
22+
"--code-complete-at",
23+
"{0}/main.cpp:20:7",
24+
"--synchronous-completions"
25+
],
26+
"expectation": [
27+
" get int get() CXXMethod Foo ",
28+
" Foo Foo:: ClassDecl Foo ",
29+
" operator= Foo & operator=(const Foo &) CXXMethod Foo ",
30+
" operator= Foo & operator=(Foo &&) CXXMethod Foo ",
31+
" ~Foo void ~Foo() CXXDestructor Foo ",
32+
""
33+
]
34+
}
2635
]
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
[
2-
{ "name": "forward_declared_object_points_to_real_declaration",
3-
"rc-command": [ "--follow-location", "{0}/contains_forward_declaration.hpp:3:16"],
4-
"expectation": ["{0}/include.hpp:2:8"] },
5-
{ "name": "forward_declared_object_points_to_real_declaration_through_macro",
6-
"rc-command": [ "--follow-location", "{0}/main.cpp:10:15", "--all-targets"],
7-
"expectation": ["{0}/include.hpp:2:8", "{0}/main.cpp:5:1"] },
8-
{ "name": "reference_to_opaque_forward_declaration",
9-
"rc-command": [ "--references", "{0}/main.cpp:13:8"],
10-
"expectation": ["{0}/main.cpp:17:5"] }
2+
{
3+
"name": "forward_declared_object_points_to_real_declaration",
4+
"rc-command": [
5+
"--follow-location",
6+
"{0}/contains_forward_declaration.hpp:3:16"
7+
],
8+
"expectation": [
9+
"{0}/include.hpp:2:8"
10+
]
11+
},
12+
{
13+
"name": "forward_declared_object_points_to_real_declaration_through_macro",
14+
"rc-command": [
15+
"--follow-location",
16+
"{0}/main.cpp:10:15",
17+
"--all-targets"
18+
],
19+
"expectation": [
20+
"{0}/include.hpp:2:8",
21+
"{0}/main.cpp:5:1"
22+
]
23+
},
24+
{
25+
"name": "reference_to_opaque_forward_declaration",
26+
"rc-command": [
27+
"--references",
28+
"{0}/main.cpp:13:8"
29+
],
30+
"expectation": [
31+
"{0}/main.cpp:17:5"
32+
]
33+
}
1134
]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
[
2-
{ "name": "classes/structs instance containing a pointer pointer field should not be a reference to the function pointer",
3-
"rc-command": [ "--references", "{0}/main.cpp:3:12" ],
4-
"expectation": [ "{0}/main.cpp:10:7" ] }
2+
{
3+
"name": "classes/structs instance containing a pointer pointer field should not be a reference to the function pointer",
4+
"rc-command": [
5+
"--references",
6+
"{0}/main.cpp:3:12"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:10:7"
10+
]
11+
}
512
]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
[
2-
{ "name": "find_references",
3-
"rc-command": [ "--references", "{0}/main.cpp:2:6"],
4-
"expectation": ["{0}/main.cpp:10:5"] }
2+
{
3+
"name": "find_references",
4+
"rc-command": [
5+
"--references",
6+
"{0}/main.cpp:2:6"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:10:5"
10+
]
11+
}
512
]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[
2-
{ "name": "inline constructor should not point to struct/class definition",
3-
"rc-command": [ "--follow-location", "{0}/main.cpp:7:5" ],
4-
"expectation": [] }
2+
{
3+
"name": "inline constructor should not point to struct/class definition",
4+
"rc-command": [
5+
"--follow-location",
6+
"{0}/main.cpp:7:5"
7+
],
8+
"expectation": []
9+
}
510
]
+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
[
2-
{ "name": "find_references",
3-
"rc-command": [ "--references", "{0}/main.cpp:2:8"],
4-
"expectation": ["{0}/main.cpp:3:24","{0}/main.cpp:7:8","{0}/main.cpp:11:9"] }
2+
{
3+
"name": "find_references",
4+
"rc-command": [
5+
"--references",
6+
"{0}/main.cpp:2:8"
7+
],
8+
"expectation": [
9+
"{0}/main.cpp:3:24",
10+
"{0}/main.cpp:7:8",
11+
"{0}/main.cpp:11:9"
12+
]
13+
}
514
]
+22-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
[
2-
{ "name": "follow_location",
3-
"rc-command": [ "--follow-location", "{0}/a.hpp:3:6"],
4-
"expectation": ["{0}/a.cpp:3:6"] },
5-
{ "name": "find_references",
6-
"rc-command": [ "--references", "{0}/a.hpp:3:6"],
7-
"expectation": ["{0}/a.cpp:6:5","{0}/main.cpp:4:5","{0}/main.cpp:5:5"] }
8-
2+
{
3+
"name": "follow_location",
4+
"rc-command": [
5+
"--follow-location",
6+
"{0}/a.hpp:3:6"
7+
],
8+
"expectation": [
9+
"{0}/a.cpp:3:6"
10+
]
11+
},
12+
{
13+
"name": "find_references",
14+
"rc-command": [
15+
"--references",
16+
"{0}/a.hpp:3:6"
17+
],
18+
"expectation": [
19+
"{0}/a.cpp:6:5",
20+
"{0}/main.cpp:4:5",
21+
"{0}/main.cpp:5:5"
22+
]
23+
}
924
]

0 commit comments

Comments
 (0)