From 8781ba58c9d6c728062b98771e4d42f67432a514 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 5 Jun 2016 13:58:46 +0100 Subject: Add a test case that scans all dependencies in the official tree --- gentoobrowse-api/unittests/Jamfile.jam | 8 ++++++++ gentoobrowse-api/unittests/testDependAll.cpp | 30 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 gentoobrowse-api/unittests/testDependAll.cpp diff --git a/gentoobrowse-api/unittests/Jamfile.jam b/gentoobrowse-api/unittests/Jamfile.jam index e41a194..465160a 100644 --- a/gentoobrowse-api/unittests/Jamfile.jam +++ b/gentoobrowse-api/unittests/Jamfile.jam @@ -49,6 +49,14 @@ run testCommon : testDepend ; +explicit testDependAll ; +run + testDependAll.cpp ../service/utils/fileUtils.cpp ../service/utils/ebuildCacheParser.cpp ../service/depend.cpp ../service/utils/lexer.cpp + : : : + BOOST_TEST_DYN_LINK + testCommon + : testDependAll ; + run testNews.cpp ../service/utils/fileUtils.cpp ../service/news.cpp ../service/utils/lexer.cpp : : : diff --git a/gentoobrowse-api/unittests/testDependAll.cpp b/gentoobrowse-api/unittests/testDependAll.cpp new file mode 100644 index 0000000..47c7363 --- /dev/null +++ b/gentoobrowse-api/unittests/testDependAll.cpp @@ -0,0 +1,30 @@ +#define BOOST_TEST_MODULE TestDependAll +#include + +#include +#include +#include +#include + +void +testDependRange(const boost::optional & r) +{ + if (r) { + Portage::Utils::Depend::parse(r->first, r->second); + } +} + +BOOST_AUTO_TEST_CASE( processAll ) +{ + for (boost::filesystem::recursive_directory_iterator d("/usr/portage/metadata/md5-cache"); + d != boost::filesystem::recursive_directory_iterator(); d++) { + if (boost::filesystem::is_regular_file(d->status())) { + BOOST_TEST_CHECKPOINT(*d); + Gentoo::Utils::EbuildCacheParser ecp(*d); + testDependRange(ecp.getRange("DEPEND")); + testDependRange(ecp.getRange("RDEPEND")); + testDependRange(ecp.getRange("PDEPEND")); + } + } +} + -- cgit v1.2.3