Skip to content

Commit

Permalink
Merge pull request #196 from Morwenn/develop
Browse files Browse the repository at this point in the history
Release 1.12.0
  • Loading branch information
Morwenn committed Dec 2, 2021
2 parents 8e4d372 + 266707b commit f081ed4
Show file tree
Hide file tree
Showing 222 changed files with 2,432 additions and 1,425 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/build-macos.yml
Expand Up @@ -64,4 +64,4 @@ jobs:
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
run: ctest -C ${{matrix.config.build_type}}
run: ctest -C ${{matrix.config.build_type}} --no-tests=error
2 changes: 1 addition & 1 deletion .github/workflows/build-mingw.yml
Expand Up @@ -51,4 +51,4 @@ jobs:
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
run: ctest -C ${{matrix.build_type}}
run: ctest -C ${{matrix.build_type}} --no-tests=error
2 changes: 1 addition & 1 deletion .github/workflows/build-msvc.yml
Expand Up @@ -51,4 +51,4 @@ jobs:
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
run: ctest -C ${{matrix.build_type}}
run: ctest -C ${{matrix.build_type}} --no-tests=error
15 changes: 11 additions & 4 deletions .github/workflows/build-ubuntu.yml
Expand Up @@ -23,7 +23,7 @@ on:

jobs:
build:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04

strategy:
fail-fast: false
Expand All @@ -45,6 +45,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Install GCC
if: ${{matrix.cxx == 'g++-5'}}
run: sudo apt-get install -y g++-5

- name: Install Clang
if: ${{matrix.cxx == 'clang++-6.0'}}
run: sudo apt-get install -y clang-6.0 lld-6.0
Expand Down Expand Up @@ -83,6 +87,9 @@ jobs:
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
run: |
ctest -T memcheck -C ${{matrix.config.build_type}} -j 2
find ./Testing/Temporary -name "MemoryChecker.*.log" -size +1300c | xargs cat;
run: ctest -T memcheck -C ${{matrix.config.build_type}} --no-tests=error -j 2

- name: Show Valgrind logs
if: ${{failure() && matrix.config.valgrind == 'ON'}}
working-directory: ${{runner.workspace}}/build
run: find ./Testing/Temporary -name "MemoryChecker.*.log" -size +1300c | xargs cat
29 changes: 16 additions & 13 deletions .github/workflows/code-coverage.yml
Expand Up @@ -11,15 +11,12 @@ on:
- 2.0.0-develop
paths:
- '.github/workflows/code-coverage.yml'
- '.github/.codecov.yml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'codecov.yml'
- 'include/**'
- 'testsuite/**'

env:
BUILD_TYPE: Debug

jobs:
upload-coverage:
runs-on: ubuntu-latest
Expand All @@ -28,32 +25,38 @@ jobs:
- name: Checkout project
uses: actions/checkout@v2

- name: Install LCOV
run: sudo apt-get install -y lcov

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}
run: >
cmake -H${{github.event.repository.name}} -Bbuild
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
-DCPPSORT_ENABLE_COVERAGE=true
-DCMAKE_BUILD_TYPE=Debug
-DCPPSORT_ENABLE_COVERAGE=ON
-G"Unix Makefiles"
- name: Build with coverage
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
run: cmake --build . --config Debug -j 2

- name: Run the test suite
shell: bash
env:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: ${{runner.workspace}}/build
run: ctest -C Release --output-on-failure
run: ctest -C Debug --no-tests=error

- name: Create coverage info
- name: Capture coverage info
shell: bash
working-directory: ${{runner.workspace}}/build
run: make gcov
run: cmake --build . --target lcov-capture

- name: Upload coverage info
uses: codecov/codecov-action@v1.2.1
uses: codecov/codecov-action@v2
with:
directory: ${{runner.workspace}}/build
functionalities: gcov
directory: ${{runner.workspace}}/build/lcov/data
files: '*.info'
fail_ci_if_error: true
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.8.0)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

project(cpp-sort VERSION 1.11.0 LANGUAGES CXX)
project(cpp-sort VERSION 1.12.0 LANGUAGES CXX)

include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
Expand Down
18 changes: 11 additions & 7 deletions README.md
@@ -1,5 +1,5 @@
[![Latest Release](https://img.shields.io/badge/release-1.11.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.11.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.11.0-blue.svg)](https://conan.io/center/cpp-sort?version=1.11.0)
[![Latest Release](https://img.shields.io/badge/release-1.12.0-blue.svg)](https://github.com/Morwenn/cpp-sort/releases/tag/1.12.0)
[![Conan Package](https://img.shields.io/badge/conan-cpp--sort%2F1.12.0-blue.svg)](https://conan.io/center/cpp-sort?version=1.12.0)
[![Code Coverage](https://codecov.io/gh/Morwenn/cpp-sort/branch/develop/graph/badge.svg)](https://codecov.io/gh/Morwenn/cpp-sort)

> *It would be nice if only one or two of the sorting methods would dominate all of the others,
Expand Down Expand Up @@ -47,7 +47,6 @@ Here is a more complete example of what can be done with the library:
#include <cassert>
#include <forward_list>
#include <functional>
#include <iterator>
#include <vector>
#include <cpp-sort/adapters.h>
#include <cpp-sort/sorters.h>
Expand All @@ -71,9 +70,9 @@ int main()
sorter(vec, std::greater<>{}, &wrapper::value);

assert(std::equal(
std::begin(li), std::end(li),
std::begin(vec), std::end(vec),
[](auto& lhs, auto& rhs) { return lhs.value == rhs.value; }
li.begin(), li.end(),
vec.begin(), vec.end(),
[](const auto& lhs, const auto& rhs) { return lhs.value == rhs.value; }
));
}
```
Expand Down Expand Up @@ -110,7 +109,7 @@ wiki page](https://github.com/Morwenn/cpp-sort/wiki/Benchmarks).
# Compiler support & tooling

![Ubuntu builds status](https://github.com/Morwenn/cpp-sort/workflows/Ubuntu%20Builds/badge.svg?branch=develop)
![Windows builds status](https://github.com/Morwenn/cpp-sort/workflows/Windows%20Builds/badge.svg?branch=develop)
![Windows builds status](https://github.com/Morwenn/cpp-sort/workflows/MSVC%20Builds/badge.svg?branch=develop)
![MacOS builds status](https://github.com/Morwenn/cpp-sort/workflows/MacOS%20Builds/badge.svg?branch=develop)

**cpp-sort** requires C++14 support, and should work with the following compilers:
Expand Down Expand Up @@ -219,6 +218,11 @@ discussion](https://stackoverflow.com/q/2786899/1364752) on StackOverflow and ar
backed by the article [*Applying Sorting Networks to Synthesize Optimized Sorting
Libraries*](https://arxiv.org/abs/1505.01962).

* The test suite reimplements random number algorithms originally found in the following places:
- [xoshiro256\*\*](https://prng.di.unimi.it/)
- [*Optimal Discrete Uniform Generation from Coin Flips, and Applications*](https://arxiv.org/abs/1304.1916)
- [*All numbers in a given range but random order*](https://stackoverflow.com/a/44821946/1364752)

* The LaTeX scripts used to draw the sorting networks are modified versions of
kaayy's [`sortingnetwork.tex`](https://github.com/kaayy/kaayy-s-code-sinppets),
slightly adapted to be 0-based and draw the network from top to bottom.
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/errorbar-plot/bench.cpp
Expand Up @@ -17,9 +17,9 @@
#include <utility>
#include <vector>
#include <cpp-sort/sorters.h>
#include "distributions.h"
#include "filesystem.h"
#include "statistics.h"
#include "../benchmarking-tools/distributions.h"
#include "../benchmarking-tools/filesystem.h"
#include "../benchmarking-tools/statistics.h"

using namespace std::chrono_literals;

Expand Down
10 changes: 5 additions & 5 deletions benchmarks/inversions/inv-bench.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Morwenn
* Copyright (c) 2020-2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#include <cassert>
Expand All @@ -14,10 +14,10 @@
#include <utility>
#include <vector>
#include <cpp-sort/sorters.h>
#include "distributions.h"
#include "filesystem.h"
#include "rdtsc.h"
#include "statistics.h"
#include "../benchmarking-tools/distributions.h"
#include "../benchmarking-tools/filesystem.h"
#include "../benchmarking-tools/rdtsc.h"
#include "../benchmarking-tools/statistics.h"

using namespace std::chrono_literals;

Expand Down
4 changes: 2 additions & 2 deletions benchmarks/patterns/bench.cpp
Expand Up @@ -36,8 +36,8 @@
#include <utility>
#include <vector>
#include <cpp-sort/sorters.h>
#include "distributions.h"
#include "rdtsc.h"
#include "../benchmarking-tools/distributions.h"
#include "../benchmarking-tools/rdtsc.h"

// Type of data to sort during the benchmark
using value_t = double;
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/small-array/benchmark.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2020 Morwenn
* Copyright (c) 2015-2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#include <algorithm>
Expand All @@ -16,8 +16,8 @@
#include <cpp-sort/adapters.h>
#include <cpp-sort/fixed_sorters.h>
#include <cpp-sort/sorters.h>
#include "distributions.h"
#include "rdtsc.h"
#include "../benchmarking-tools/distributions.h"
#include "../benchmarking-tools/rdtsc.h"

using namespace std::chrono_literals;

Expand Down
17 changes: 11 additions & 6 deletions cmake/FindGcov.cmake
@@ -1,7 +1,7 @@
# This file is part of CMake-codecov.
#
# Copyright (c)
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
# 2015-2020 RWTH Aachen University, Federal Republic of Germany
#
# See the LICENSE file in the package base directory for details
#
Expand All @@ -19,7 +19,7 @@ set(CMAKE_REQUIRED_QUIET ${codecov_FIND_QUIETLY})

get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
foreach (LANG ${ENABLED_LANGUAGES})
# Gcov evaluation is dependend on the used compiler. Check gcov support for
# Gcov evaluation is dependent on the used compiler. Check gcov support for
# each compiler that is used. If gcov binary was already found for this
# compiler, do not try to find it again.
if (NOT GCOV_${CMAKE_${LANG}_COMPILER_ID}_BIN)
Expand All @@ -35,7 +35,7 @@ foreach (LANG ${ENABLED_LANGUAGES})
find_program(GCOV_BIN NAMES gcov-${GCC_VERSION} gcov
HINTS ${COMPILER_PATH})

elseif ("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "Clang")
elseif ("${CMAKE_${LANG}_COMPILER_ID}" MATCHES "^(Apple)?Clang$")
# Some distributions like Debian ship llvm-cov with the compiler
# version appended as llvm-cov-x.y. To find this binary we'll build
# the suggested binary name with the compiler version.
Expand Down Expand Up @@ -105,7 +105,8 @@ endif (NOT TARGET gcov)
# Gcov on any source file of <TNAME> once and store the gcov file in the same
# directory.
function (add_gcov_target TNAME)
set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
get_target_property(TBIN_DIR ${TNAME} BINARY_DIR)
set(TDIR ${TBIN_DIR}/CMakeFiles/${TNAME}.dir)

# We don't have to check, if the target has support for coverage, thus this
# will be checked by add_coverage_target in Findcoverage.cmake. Instead we
Expand Down Expand Up @@ -135,14 +136,18 @@ function (add_gcov_target TNAME)


set(BUFFER "")
set(NULL_DEVICE "/dev/null")
if(WIN32)
set(NULL_DEVICE "NUL")
endif()
foreach(FILE ${SOURCES})
get_filename_component(FILE_PATH "${TDIR}/${FILE}" PATH)

# call gcov
add_custom_command(OUTPUT ${TDIR}/${FILE}.gcov
COMMAND ${GCOV_ENV} ${GCOV_BIN} ${TDIR}/${FILE}.gcno > /dev/null
COMMAND ${GCOV_ENV} ${GCOV_BIN} -p ${TDIR}/${FILE}.gcno > ${NULL_DEVICE}
DEPENDS ${TNAME} ${TDIR}/${FILE}.gcno
WORKING_DIRECTORY ${FILE_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

list(APPEND BUFFER ${TDIR}/${FILE}.gcov)
Expand Down
21 changes: 15 additions & 6 deletions cmake/FindLcov.cmake
@@ -1,7 +1,7 @@
# This file is part of CMake-codecov.
#
# Copyright (c)
# 2015-2017 RWTH Aachen University, Federal Republic of Germany
# 2015-2020 RWTH Aachen University, Federal Republic of Germany
#
# See the LICENSE file in the package base directory for details
#
Expand Down Expand Up @@ -53,7 +53,7 @@ include(FindPackageHandleStandardArgs)
find_program(LCOV_BIN lcov)
find_program(GENINFO_BIN geninfo)
find_program(GENHTML_BIN genhtml)
find_package_handle_standard_args(lcov
find_package_handle_standard_args(Lcov
REQUIRED_VARS LCOV_BIN GENINFO_BIN GENHTML_BIN
)

Expand Down Expand Up @@ -159,7 +159,9 @@ function (lcov_capture_initial_tgt TNAME)
set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")


set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
get_target_property(TBIN_DIR ${TNAME} BINARY_DIR)
set(TDIR ${TBIN_DIR}/CMakeFiles/${TNAME}.dir)

set(GENINFO_FILES "")
foreach(FILE ${SOURCES})
# generate empty coverage files
Expand Down Expand Up @@ -249,23 +251,30 @@ function (lcov_capture_tgt TNAME)
set(GCOV_BIN "${GCOV_${TCOMPILER}_BIN}")
set(GCOV_ENV "${GCOV_${TCOMPILER}_ENV}")

get_target_property(TBIN_DIR ${TNAME} BINARY_DIR)
set(TDIR ${TBIN_DIR}/CMakeFiles/${TNAME}.dir)

set(TDIR ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${TNAME}.dir)
set(GENINFO_FILES "")
foreach(FILE ${SOURCES})
# Generate coverage files. If no .gcda file was generated during
# execution, the empty coverage file will be used instead.
set(OUTFILE "${TDIR}/${FILE}.info")
list(APPEND GENINFO_FILES ${OUTFILE})

# Create an empty .gcda file, so the target capture file can have a dependency on it.
# The capture file will only use this .gcda if it has a non-zero size (test -s).
add_custom_command(OUTPUT "${TDIR}/${FILE}.gcda"
COMMAND "${CMAKE_COMMAND}" -E touch "${TDIR}/${FILE}.gcda"
)

add_custom_command(OUTPUT ${OUTFILE}
COMMAND test -f "${TDIR}/${FILE}.gcda"
COMMAND test -s "${TDIR}/${FILE}.gcda"
&& ${GCOV_ENV} ${GENINFO_BIN} --quiet --base-directory
${PROJECT_SOURCE_DIR} --gcov-tool ${GCOV_BIN}
--output-filename ${OUTFILE} ${GENINFO_EXTERN_FLAG}
${TDIR}/${FILE}.gcda
|| cp ${OUTFILE}.init ${OUTFILE}
DEPENDS ${TNAME} ${TNAME}-capture-init
DEPENDS ${TNAME} ${TNAME}-capture-init "${TDIR}/${FILE}.gcda"
COMMENT "Capturing coverage data for ${FILE}"
)
endforeach()
Expand Down

0 comments on commit f081ed4

Please sign in to comment.