diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-05 13:58:46 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-05 14:15:26 +0100 |
commit | 8781ba58c9d6c728062b98771e4d42f67432a514 (patch) | |
tree | 13d437cbaedf156912addc7c5fe952c986808910 | |
parent | Use covering unique indexes for ebuild use and arch merge (diff) | |
download | gentoobrowse-api-8781ba58c9d6c728062b98771e4d42f67432a514.tar.bz2 gentoobrowse-api-8781ba58c9d6c728062b98771e4d42f67432a514.tar.xz gentoobrowse-api-8781ba58c9d6c728062b98771e4d42f67432a514.zip |
Add a test case that scans all dependencies in the official tree
-rw-r--r-- | gentoobrowse-api/unittests/Jamfile.jam | 8 | ||||
-rw-r--r-- | gentoobrowse-api/unittests/testDependAll.cpp | 30 |
2 files changed, 38 insertions, 0 deletions
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 <library>testCommon : testDepend ; +explicit testDependAll ; +run + testDependAll.cpp ../service/utils/fileUtils.cpp ../service/utils/ebuildCacheParser.cpp ../service/depend.cpp ../service/utils/lexer.cpp + : : : + <define>BOOST_TEST_DYN_LINK + <library>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 <boost/test/unit_test.hpp> + +#include <depend.h> +#include <utils/ebuildCacheParser.h> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/convenience.hpp> + +void +testDependRange(const boost::optional<Gentoo::Utils::EbuildCacheParser::Range> & 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")); + } + } +} + |