From f23db9de02266ffa84ab7c981daebb59b2e59f2a Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 22 Apr 2019 12:28:22 +0300 Subject: [PATCH] - Enable the test suite on the check stage --- freecell-solver-avoid-test-dependencies.patch | 111 ++++++++++++++++++ freecell-solver.spec | 37 +++++- 2 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 freecell-solver-avoid-test-dependencies.patch diff --git a/freecell-solver-avoid-test-dependencies.patch b/freecell-solver-avoid-test-dependencies.patch new file mode 100644 index 0000000..e652232 --- /dev/null +++ b/freecell-solver-avoid-test-dependencies.patch @@ -0,0 +1,111 @@ +--- freecell-solver-5.6.0/t/CMakeLists.txt.orig 2019-04-18 22:49:30.701874513 +0300 ++++ freecell-solver-5.6.0/t/CMakeLists.txt 2019-04-18 22:49:41.059812941 +0300 +@@ -45,48 +45,13 @@ + + IF (FCS_WITH_TEST_SUITE) + +- SET (MODULE "Task::FreecellSolver::Testing") +- EXECUTE_PROCESS ( +- COMMAND "${PERL_EXECUTABLE}" "-M${MODULE}=" "-e" "exit(0)" +- RESULT_VARIABLE "RESULT" +- ) +- IF (NOT RESULT EQUAL 0) +- MESSAGE(FATAL_ERROR "You need the Perl 5/CPAN distribution ${MODULE} to run the test suite. Either skip the test suite using -DFCS_WITH_TEST_SUITE=OFF or see http://perl-begin.org/topics/cpan/ for installing from CPAN.") +- ENDIF () +- +- FIND_LIBRARY(LIBTAP_LIB tap) +- IF (NOT LIBTAP_LIB) +- MESSAGE (FATAL_ERROR +-"You must install libtap ( http://www.shlomifish.org/open-source/projects/libtap/ ) and its development package or headers to run the test suite. +-If you're not interested in building it, run cmake with the -DFCS_WITH_TEST_SUITE= flag." +- ) +- ENDIF () + MY_FIND_GMP ("to run the test suite." "FCS_WITH_TEST_SUITE") + + INCLUDE_DIRECTORIES (BEFORE "${CMAKE_BINARY_DIR}") + +- MY_ADD_EXE ( +- "card-test-render.t.exe" +- "card-test-render.c" +- ) +- +- MY_ADD_EXE ( +- "card-test-parse.t.exe" +- "card-test-parse.c" +- ) +- + FILE (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/t") + FILE (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/verify-cache") + +- SET (EXE_FILE "bit-reader-and-writer-test.t.exe") +- +- ADD_EXECUTABLE( +- "${EXE_FILE}" +- "${CMAKE_CURRENT_SOURCE_DIR}/bit-reader-and-writer-test.c" +- ) +- +- TARGET_LINK_LIBRARIES (${EXE_FILE} ${LIBTAP_LIB}) +- + SET_SOURCE_FILES_PROPERTIES ( + "bit-reader-and-writer-test.c" + PROPERTIES +@@ -95,59 +60,10 @@ + + IF ("${DEBONDT_DELTA_STATES}") + +- SET (EXE_FILE "delta-states-debondt-test.t.exe") +- +- ADD_EXECUTABLE( +- "${EXE_FILE}" +- "${CMAKE_CURRENT_SOURCE_DIR}/debondt-delta-states-test.c" +- ) +- +- TARGET_LINK_LIBRARIES (${EXE_FILE} ${LIBTAP_LIB} ${LIBGMP_LIB}) +- +- SET_SOURCE_FILES_PROPERTIES ( +- "delta-states-test.c" +- PROPERTIES +- OBJECT_DEPENDS +- "${CMAKE_CURRENT_SOURCE_DIR}/../delta_states_debondt.c" +- GENERATED "1" +- ) +- + ELSE () + +- SET (EXE_FILE "delta-states-test.t.exe") +- +- ADD_EXECUTABLE( +- "${EXE_FILE}" +- "${CMAKE_CURRENT_SOURCE_DIR}/delta-states-test.c" +- "${CMAKE_CURRENT_SOURCE_DIR}/../delta_states.c" +- ) +- +- TARGET_LINK_LIBRARIES (${EXE_FILE} ${LIBTAP_LIB} ${LIBGMP_LIB}) +- +- SET_SOURCE_FILES_PROPERTIES ( +- "delta-states-test.c" +- PROPERTIES +- OBJECT_DEPENDS +- "${CMAKE_CURRENT_SOURCE_DIR}/../delta_states.c" +- GENERATED "1" +- ) + ENDIF () + +- SET (EXE_FILE "dbm-kaztree-compare-records-test.t.exe") +- +- ADD_EXECUTABLE( +- "${EXE_FILE}" +- "dbm-kaztree-compare-records-test.c" +- ) +- +- # This is a kind-of-temporary kludge to make +- # "dbm-kaztree-compare-records-test.c" build. +- ADD_DEFINITIONS("-DFCS_DBM_USE_LIBAVL=1" +- "-I${CMAKE_CURRENT_SOURCE_DIR}/.." +- "-I${CMAKE_CURRENT_SOURCE_DIR}/../fcs-libavl/" +- ) +- TARGET_LINK_LIBRARIES (${EXE_FILE} ${LIBTAP_LIB}) +- + GEN_INDIVIDUAL_TESTS( + "generate_valgrind_tests" + "${PROJECT_SOURCE_DIR}/scripts/gen-individual-valgrind-test-scripts.pl" diff --git a/freecell-solver.spec b/freecell-solver.spec index 8fef63c..8646ef3 100644 --- a/freecell-solver.spec +++ b/freecell-solver.spec @@ -4,10 +4,11 @@ Name: freecell-solver Version: 5.6.0 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT Source0: https://fc-solve.shlomifish.org/downloads/fc-solve/%{name}-%{version}.tar.xz Patch1: freecell-solver-no-rpath.diff +Patch2: freecell-solver-avoid-test-dependencies.patch URL: https://fc-solve.shlomifish.org/ Summary: The Freecell Solver Executable @@ -23,21 +24,48 @@ BuildRequires: perl(Carp) BuildRequires: perl(Cwd) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Digest::SHA) +BuildRequires: perl(Env::Path) BuildRequires: perl(File::Path) BuildRequires: perl(File::Spec) +BuildRequires: perl(File::Which) +BuildRequires: perl(Games::Solitaire::Verify) +BuildRequires: perl(Games::Solitaire::Verify::Solution) +BuildRequires: perl(Inline) +BuildRequires: perl(Inline::C) +BuildRequires: perl(IPC::Open2) BuildRequires: perl(lib) BuildRequires: perl(List::MoreUtils) +BuildRequires: perl(Moo) +BuildRequires: perl(MooX) +BuildRequires: perl(MooX::late) BuildRequires: perl(parent) BuildRequires: perl(Path::Tiny) +BuildRequires: perl(Storable) BuildRequires: perl(strict) +BuildRequires: perl(String::ShellQuote) +# BuildRequires: perl(Task::FreecellSolver::Testing) BuildRequires: perl(Template) +BuildRequires: perl(Test::Data::Split) +BuildRequires: perl(Test::Data::Split::Backend::Hash) +BuildRequires: perl(Test::Data::Split::Backend::ValidateHash) +BuildRequires: perl(Test::Differences) +BuildRequires: perl(Test::More) +BuildRequires: perl(Test::RunValgrind) +BuildRequires: perl(Test::TrailingSpace) +BuildRequires: perl(Test::Trap) BuildRequires: perl(warnings) +BuildRequires: perl(YAML::XS) BuildRequires: perl-devel +BuildRequires: python3-cffi BuildRequires: python3-pysol-cards BuildRequires: python3-random2 BuildRequires: python3-rpm-macros BuildRequires: python3dist(six) +BuildRequires: python3dist(pycotap) Requires: %{libname}%{?_isa} = %{version}-%{release} +# BuildRequires: tap-devel +BuildRequires: the_silver_searcher +BuildRequires: valgrind %description The Freecell Solver package contains the fc-solve executable which is @@ -116,12 +144,17 @@ Freecell Solver from within your programs. %prep %setup -q %patch1 -p1 -b .rem-rpath +%patch2 -p1 -b .avoid-test-deps %build # The game limit flags are recommended by the PySolFC README. -%cmake -DLOCALE_INSTALL_DIR=%{_datadir}/locale -DLIB_INSTALL_DIR=%{_libdir} -DMAX_NUM_FREECELLS=8 -DMAX_NUM_STACKS=20 -DMAX_NUM_INITIAL_CARDS_IN_A_STACK=60 -DFCS_WITH_TEST_SUITE=OFF +%cmake -DLOCALE_INSTALL_DIR=%{_datadir}/locale -DLIB_INSTALL_DIR=%{_libdir} -DMAX_NUM_FREECELLS=8 -DMAX_NUM_STACKS=20 -DMAX_NUM_INITIAL_CARDS_IN_A_STACK=60 %make_build +%check +%__rm -f t/t/tidyall.t +perl ./run-tests.pl + %install %make_install bn="fc_solve_find_index_s2ints.py"