Testing installation.

This commit is contained in:
Daniel Lemire 2021-03-01 13:36:09 -05:00
parent edd19b399e
commit e16353a057
3 changed files with 47 additions and 19 deletions

View File

@ -15,20 +15,13 @@ jobs:
#- {cxx: , arch: -DCMAKE_CXX_FLAGS="-m32"} # default=gcc9
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.4
with:
cmake-version: '3.11.x'
#- name: install older compilers
# run: |
# sudo -E dpkg --add-architecture i386
# sudo -E apt-get update
# sudo -E apt-get install -y g++-8 g++-8-multilib g++-multilib linux-libc-dev:i386 libc6:i386 libc6-dev:i386 libc6-dbg:i386
- name: Prepare build dir
run: mkdir build
- name: Configure
run: cd build && cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
- name: Build
run: cmake --build build
- name: Run basic tests
run: cd build && ctest --output-on-failure -R basictest
- name: Use cmake
run: |
mkdir build &&
cd build &&
cmake ${{matrix.cxx}} ${{matrix.arch}} -DFASTFLOAT_TEST=ON -DCMAKE_INSTALL_PREFIX:PATH=destination .. &&
cmake --build . &&
ctest --output-on-failure &&
cmake --install . &&
cd ../tests/installation_tests/find &&
mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=../../../build/destination .. && cmake --build .

View File

@ -21,7 +21,14 @@ jobs:
cd build && cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -DFASTFLOAT_TEST=ON ..
- name: Build
run: cmake --build build --config Release --parallel
- name: Run basic tests
- name: Run tests
run: |
cd build
ctest -C Release --output-on-failure -R basictest
ctest -C Release --output-on-failure
- name: Install
run: |
cmake --install build --config Release
- name: Test Installation
run: |
cmake -G "${{matrix.gen}}" -A ${{matrix.arch}} -B build_install_test tests/installation_tests/find
cmake --build build_install_test --config Release

View File

@ -0,0 +1,28 @@
cmake_minimum_required(VERSION 3.15)
project(test_simdjson_install VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(fast_float REQUIRED)
file(WRITE main.cpp "
#include \"fast_float/fast_float.h\"
#include <iostream>
int main() {
const std::string input = \"3.1416 xyz \";
double result;
auto answer = fast_float::from_chars(input.data(), input.data()+input.size(), result);
if(answer.ec != std::errc()) { std::cerr << \"parsing failure\n\"; return EXIT_FAILURE; }
std::cout << \"parsed the number \" << result << std::endl;
return EXIT_SUCCESS;
}")
add_executable(repro main.cpp)
target_link_libraries(repro PUBLIC fast_float::fast_float)