Skip to content

Commit

Permalink
Rollback #869
Browse files Browse the repository at this point in the history
  • Loading branch information
zekoz authored and lmoureaux committed Feb 18, 2022
1 parent f82eef6 commit 38eac2f
Show file tree
Hide file tree
Showing 18 changed files with 10 additions and 230 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ jobs:
- name: Build
run: |
cmake --build build
- name: Test
run: |
cmake --build build --target test
- name: Debug
if: failure()
run: |
cat build/Testing/Temporary/LastTest.log
- name: Install
run: |
DESTDIR=$PWD/build/install cmake --build build --target install
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ cmake_install.cmake
Makefile
build.ninja
*_autogen
/Testing

# Build directories
/build*
Expand Down
8 changes: 0 additions & 8 deletions cmake/FreecivDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,3 @@ endif()
if (FREECIV_ENABLE_FCMP_CLI OR FREECIV_ENABLE_FCMP_QT)
find_package(SQLite3 REQUIRED)
endif()

# Testing
if (NOT EMSCRIPTEN)
include(CTest)
if (BUILD_TESTING)
find_package(Qt5Test REQUIRED)
endif()
endif()
11 changes: 0 additions & 11 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(RULESET_LIST)

function(add_ruleset)
cmake_parse_arguments(ARG "SERV_FILE" "NAME;README" "" ${ARGN})
if (ARG_SERV_FILE)
Expand All @@ -14,8 +12,6 @@ function(add_ruleset)
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/${ARG_NAME}"
COMPONENT freeciv21)
endif()
list(APPEND RULESET_LIST ${ARG_NAME})
set(RULESET_LIST "${RULESET_LIST}" PARENT_SCOPE)
install(
FILES
${ARG_NAME}/buildings.ruleset
Expand Down Expand Up @@ -79,13 +75,6 @@ if (FREECIV_ENABLE_SERVER OR FREECIV_ENABLE_RULEDIT)
FILES override/nation.ruleset
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/override"
COMPONENT freeciv21)

# Ruleset tests
if (BUILD_TESTING AND FREECIV_ENABLE_SERVER)
# The stub ruleset isn't installed, but we test it
list(APPEND RULESET_LIST stub)
add_subdirectory(tests)
endif()
endif()

if (FREECIV_ENABLE_SERVER)
Expand Down
21 changes: 0 additions & 21 deletions data/tests/CMakeLists.txt

This file was deleted.

61 changes: 0 additions & 61 deletions data/tests/rulesets.cpp.in

This file was deleted.

5 changes: 0 additions & 5 deletions docs/Contributing/eval-pull-request.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ This page assumes the user knows how to use :file:`git`, compile Freeciv21 and u
$ cmake --build build --target install
$ cmake --build build --target package # MSys2 Only
:strong:`Run tests`

..code-block:: sh

$ cmake --build build --target test
:strong:`Read The Issue's Notes`

Expand Down
5 changes: 0 additions & 5 deletions server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,3 @@ add_dependencies(freeciv21-server freeciv_translations)
install(TARGETS freeciv21-server
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT freeciv21)

# Tests
if (BUILD_TESTING AND FREECIV_ENABLE_SERVER)
add_subdirectory(tests)
endif()
21 changes: 5 additions & 16 deletions server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ server::server()
m_eot_timer = timer_new(TIMER_CPU, TIMER_ACTIVE);

// Prepare a game
if (!prepare_game()) {
// Unable to start the game. Rely on the caller checking our state and
// not starting the event loop.
return;
}
prepare_game();
con_prompt_init();
if (m_interactive) {
init_interactive();
Expand Down Expand Up @@ -592,8 +588,6 @@ void server::input_on_stdin()
// Read from the input
QFile f;
f.open(stdin, QIODevice::ReadOnly);
// Force it to try and read something.
f.peek(1);
if (f.atEnd() && m_stdin_notifier != nullptr) {
// QSocketNotifier gets mad after EOF. Turn it off.
m_stdin_notifier->deleteLater();
Expand All @@ -616,18 +610,15 @@ void server::input_on_stdin()
/**
Prepares for a new game.
*/
bool server::prepare_game()
void server::prepare_game()
{
set_server_state(S_S_INITIAL);

// Load a script file.
if (!srvarg.script_filename.isEmpty()) {
if (NULL != srvarg.script_filename) {
// Adding an error message more here will duplicate them.
auto ok = read_init_script(NULL, qUtf8Printable(srvarg.script_filename),
true, false);
if (!ok) {
return false;
}
(void) read_init_script(NULL, qUtf8Printable(srvarg.script_filename),
true, false);
}

(void) aifill(game.info.aifill);
Expand All @@ -641,8 +632,6 @@ bool server::prepare_game()
// Autogame, start as soon as the event loop allows
QTimer::singleShot(0, this, &server::update_game_state);
}

return true;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private slots:
void send_pings();

// Higher-level stuff
bool prepare_game();
void prepare_game();
void begin_turn();
void begin_phase();
void end_phase();
Expand Down
15 changes: 4 additions & 11 deletions server/stdinhand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1188,24 +1188,17 @@ static bool read_init_script_real(struct connection *caller,
if (QFile::exists(real_filename)
&& (script_file = fc_fopen(qUtf8Printable(real_filename), "r"))) {
char buffer[MAX_LEN_CONSOLE_LINE];
bool ok = true;

// the size is set as to not overflow buffer in handle_stdin_input
while (fgets(buffer, MAX_LEN_CONSOLE_LINE - 1, script_file)) {
// Execute script contents with same permissions as caller
if (!handle_stdin_input_real(caller, buffer, check,
read_recursion + 1)) {
// Errors are fatal
qCritical() << buffer;
ok = false;
break;
}
handle_stdin_input_real(caller, buffer, check, read_recursion + 1);
}
fclose(script_file);

show_ruleset_info(caller, CMD_READ_SCRIPT, check, read_recursion);

return ok;
return true;
} else {
cmd_reply(CMD_READ_SCRIPT, caller, C_FAIL,
_("Cannot read command line scriptfile '%s'."),
Expand Down Expand Up @@ -3921,7 +3914,7 @@ static bool set_rulesetdir(struct connection *caller, char *str, bool check,
if (strcmp(str, game.server.rulesetdir) == 0) {
cmd_reply(CMD_RULESETDIR, caller, C_COMMENT,
_("Ruleset directory is already \"%s\""), str);
return true;
return false;
}

if (is_restricted(caller)
Expand Down Expand Up @@ -4369,7 +4362,7 @@ static bool handle_stdin_input_real(struct connection *caller, char *str,
cptr_s = str = skip_leading_spaces(str);
if ('\0' == *cptr_s || '#' == *cptr_s) {
// This appear to be a comment or blank line.
return true;
return false;
}

if (SERVER_COMMAND_PREFIX == *cptr_s) {
Expand Down
13 changes: 0 additions & 13 deletions server/tests/CMakeLists.txt

This file was deleted.

64 changes: 0 additions & 64 deletions server/tests/cli.cpp.in

This file was deleted.

2 changes: 0 additions & 2 deletions server/tests/cli/comment.serv

This file was deleted.

Empty file removed server/tests/cli/empty.serv
Empty file.
1 change: 0 additions & 1 deletion server/tests/cli/reread.serv

This file was deleted.

2 changes: 0 additions & 2 deletions server/tests/cli/set.serv

This file was deleted.

1 change: 0 additions & 1 deletion server/tests/cli/unknown.serv

This file was deleted.

0 comments on commit 38eac2f

Please sign in to comment.