Skip to content

Commit

Permalink
re-arrange unit test building
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed Mar 5, 2022
1 parent b540e04 commit 5df4227
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 17 deletions.
6 changes: 3 additions & 3 deletions include/SalmonConfig.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
>HEADER
Copyright (c) 2014-2021 Rob Patro rob@cs.umd.edu
Copyright (c) 2014-2022 Rob Patro rob@cs.umd.edu
This file is part of Salmon.
Expand All @@ -26,9 +26,9 @@

namespace salmon {
constexpr char majorVersion[] = "1";
constexpr char minorVersion[] = "7";
constexpr char minorVersion[] = "8";
constexpr char patchVersion[] = "0";
constexpr char version[] = "1.7.0";
constexpr char version[] = "1.8.0";
constexpr uint32_t indexVersion = 5;
constexpr char requiredQuasiIndexVersion[] = "p7";
} // namespace salmon
Expand Down
2 changes: 1 addition & 1 deletion scripts/fetchPufferfish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if [ -d ${INSTALL_DIR}/src/pufferfish ] ; then
fi

#SVER=salmon-v1.7.0
SVER=onetbb
SVER=develop
#SVER=sketch-mode

EXPECTED_SHA256=5894fabbf6829a3d4a627135edc8326e931eb07fc792bfff3a0714e8fee8bb8b
Expand Down
21 changes: 16 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,17 @@ if(HAS_IPO AND (NOT NO_IPO))
set_property(TARGET ksw2pp PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()

set ( UNIT_TESTS_SRCS
set (UNIT_TESTS_ENTRY_SRCS
${GAT_SOURCE_DIR}/tests/UnitTests.cpp
FragmentLengthDistribution.cpp
${GAT_SOURCE_DIR}/external/install/src/pufferfish/rank9b.cpp
${GAT_SOURCE_DIR}/tests/catch.hpp
)

set (UNIT_TESTS_INDIVIDUAL_SRCS
${GAT_SOURCE_DIR}/src/FragmentLengthDistribution.cpp
${GAT_SOURCE_DIR}/external/install/src/pufferfish/rank9b.cpp
${GAT_SOURCE_DIR}/tests/GCSampleTests.cpp
${GAT_SOURCE_DIR}/tests/LibraryTypeTests.cpp
# ${GAT_SOURCE_DIR}/tests/KmerHistTests.cpp
)


Expand Down Expand Up @@ -190,8 +197,9 @@ if(HAS_IPO AND (NOT NO_IPO))
set_property(TARGET salmon PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
endif()

add_executable(unitTests ${UNIT_TESTS_SRCS})
add_library(UnitTestsMain STATIC ${UNIT_TESTS_ENTRY_SRCS} ${GAT_SOURCE_DIR}/tests/catch.hpp)

add_executable(unitTests ${UNIT_TESTS_INDIVIDUAL_SRCS} ${GAT_SOURCE_DIR}/tests/catch.hpp)
target_compile_options(unitTests PUBLIC "$<$<CONFIG:DEBUG>:${TGT_DEBUG_FLAGS}>")
target_compile_options(unitTests PUBLIC "$<$<CONFIG:RELEASE>:${TGT_RELEASE_FLAGS}>")

Expand Down Expand Up @@ -219,7 +227,7 @@ add_dependencies(salmon alevin_core)
if(TBB_RECONFIGURE OR TBB_TARGET_EXISTED)
# Link the executable
target_link_libraries(salmon
Threads::Threads
Threads::Threads
puffer
salmon_core
twopaco
Expand Down Expand Up @@ -249,19 +257,22 @@ endif()
# dependencies for unitTests
add_dependencies(salmon salmon_core)
add_dependencies(salmon alevin_core)
add_dependencies(unitTests UnitTestsMain)
#add_dependencies(salmon puffer)
#add_dependencies(salmon twopaco)
#add_dependencies(salmon graphdump)
#add_dependencies(salmon ntcard)
#add_dependencies(salmon ksw2pp)

if(TBB_RECONFIGURE OR TBB_TARGET_EXISTED)

target_link_libraries(unitTests
Threads::Threads
## PUFF_INTEGRATION
salmon_core
alevin_core
gff
UnitTestsMain
${STADEN_LIBRARIES}
${Boost_LIBRARIES}
${ICU_LIBS}
Expand Down
9 changes: 9 additions & 0 deletions tests/GCSampleTests.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#include "catch.hpp"
#include <random>
#include <unordered_map>
#include <iostream>
#include "LibraryFormat.hpp"
#include "SalmonUtils.hpp"
#include "Transcript.hpp"
#include "UtilityFunctions.hpp"


std::string generateRandomSequence(size_t length, std::uniform_int_distribution<>& dis, std::mt19937& gen) {
char nucs[] = {'A', 'C', 'G', 'T'};
Expand Down Expand Up @@ -44,6 +52,7 @@ SCENARIO("GC sampling works properly") {

THEN("Sampled is the same as unsampled : ") {
for (size_t tn = 0; tn < 1000; ++tn) {

auto l = txpsSampled[tn].RefLength;
for (size_t i = 0; i < l; ++i) {
REQUIRE(txpsSampled[tn].gcAt(i) == txpsUnSampled[tn].gcAt(i));
Expand Down
1 change: 1 addition & 0 deletions tests/KmerHistTests.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "catch.hpp"
#include "UtilityFunctions.hpp"

// from http://stackoverflow.com/questions/2380962/generate-all-combinations-of-arbitrary-alphabet-up-to-arbitrary-length
Expand Down
10 changes: 10 additions & 0 deletions tests/LibraryTypeTests.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#include "catch.hpp"
#include <random>
#include <unordered_map>
#include <iostream>
#include "LibraryFormat.hpp"
#include "SalmonUtils.hpp"
#include "Transcript.hpp"
#include "UtilityFunctions.hpp"


SCENARIO("Library types are encoded/decoded properly") {

GIVEN("A collection of library formats") {
Expand Down
10 changes: 2 additions & 8 deletions tests/UnitTests.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include <unordered_map>
#include <iostream>
#include "catch.hpp"
#include "LibraryFormat.hpp"
#include "SalmonUtils.hpp"
#include "Transcript.hpp"
#include "UtilityFunctions.hpp"

bool verbose=false; // Apparently, we *need* this (OSX)
#include "GCSampleTests.cpp"
#include "LibraryTypeTests.cpp"
//#include "GCSampleTests.cpp"
//#include "LibraryTypeTests.cpp"
//#include "KmerHistTests.cpp"

0 comments on commit 5df4227

Please sign in to comment.