summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/Jamfile.jam1
l---------gentoobrowse/gentoobrowse-cgi2
-rw-r--r--gentoobrowse/src/Jamfile.jam40
-rw-r--r--gentoobrowse/src/test.cpp126
-rw-r--r--gentoobrowse/xslt/base.xslt42
-rw-r--r--gentoobrowse/xslt/categories.xslt3
-rw-r--r--gentoobrowse/xslt/category.xslt9
-rw-r--r--gentoobrowse/xslt/home.xslt2
-rw-r--r--gentoobrowse/xslt/news.xslt1
-rw-r--r--gentoobrowse/xslt/package.xslt22
-rw-r--r--gentoobrowse/xslt/popular.xslt3
-rw-r--r--gentoobrowse/xslt/search.xslt8
-rw-r--r--gentoobrowse/xslt/use-detail.xslt2
-rw-r--r--gentoobrowse/xslt/use.xslt2
14 files changed, 208 insertions, 55 deletions
diff --git a/gentoobrowse/Jamfile.jam b/gentoobrowse/Jamfile.jam
index e69de29..038361f 100644
--- a/gentoobrowse/Jamfile.jam
+++ b/gentoobrowse/Jamfile.jam
@@ -0,0 +1 @@
+build-project src ;
diff --git a/gentoobrowse/gentoobrowse-cgi b/gentoobrowse/gentoobrowse-cgi
index 190d839..e9129f0 120000
--- a/gentoobrowse/gentoobrowse-cgi
+++ b/gentoobrowse/gentoobrowse-cgi
@@ -1 +1 @@
-src/bin/gcc-5.4.0/release/allow-ice-yes/slicer-yes/strip-on/gentoobrowse-cgi \ No newline at end of file
+src/bin/gcc-5.4.0/debug/allow-ice-yes/gentoobrowse-cgi \ No newline at end of file
diff --git a/gentoobrowse/src/Jamfile.jam b/gentoobrowse/src/Jamfile.jam
index 96b77e5..1e070a1 100644
--- a/gentoobrowse/src/Jamfile.jam
+++ b/gentoobrowse/src/Jamfile.jam
@@ -1,22 +1,25 @@
import icespider ;
+import testing ;
+lib icespider-core ;
lib icespider-common ;
lib icespider-xslt : : : : <library>../..//libxmlpp ;
lib icespider-fcgi ;
lib icespider-filesessions ;
+lib icespider-testing ;
lib adhocutil ;
lib Ice ;
lib IceUtil ;
lib pthread ;
lib boost_system ;
+lib boost_filesystem ;
lib slicer ;
lib slicer-json ;
lib slicer-xml ;
lib slicer-db ;
+lib boost_unit_test_framework ;
lib gentoobrowse-domain ;
-lib gentoobrowse : :
- <name>gentoobrowse-api
- : :
+lib gentoobrowse-api : : : :
<include>/usr/share/gentoobrowse-api
<include>/usr/share/slicer/ice
<include>/usr/include/gentoobrowse-api
@@ -34,7 +37,6 @@ lib icespider : :
<include>/usr/share/icespider/ice
<library>icespider-common
<library>icespider-xslt
- <library>icespider-fcgi
<library>icespider-filesessions
<library>adhocutil
<library>Ice
@@ -45,15 +47,37 @@ lib icespider : :
<allow-ice>yes
;
-exe gentoobrowse-cgi :
- [ glob *.cpp *.ice *.json ]
+lib gentoobrowse :
+ [ glob *.cpp *.ice *.json : test.cpp ]
:
<variant>release:<cxxflags>-flto=3
<variant>release:<linkflags>-flto=3
<slicer>yes
<include>.
- <library>icespider
- <library>gentoobrowse
+ <library>gentoobrowse-api
<library>slicer-json
<library>slicer-xml
+ <library>icespider
+ : :
+ <library>icespider
;
+
+exe gentoobrowse-cgi :
+ gentoobrowse
+ :
+ <library>gentoobrowse
+ <library>icespider-fcgi
+ <link>shared
+ ;
+
+path-constant me : . ;
+run
+ test.cpp
+ : : :
+ <define>BOOST_TEST_DYN_LINK
+ <define>ROOT=\"$(me)\"
+ <library>boost_filesystem
+ <library>gentoobrowse
+ <library>icespider-testing
+ <library>boost_unit_test_framework
+ : gentoobrowse-test ;
diff --git a/gentoobrowse/src/test.cpp b/gentoobrowse/src/test.cpp
new file mode 100644
index 0000000..994a8df
--- /dev/null
+++ b/gentoobrowse/src/test.cpp
@@ -0,0 +1,126 @@
+#define BOOST_TEST_MODULE TestGentooBrowse
+#include <boost/test/unit_test.hpp>
+
+#include <core.h>
+#include <definedDirs.h>
+#include <boost/filesystem/operations.hpp>
+#include <testRequest.h>
+
+using namespace IceSpider;
+
+class ChromiumRequest : public TestRequest {
+ public:
+ ChromiumRequest(const Core * c, HttpMethod m, const std::string & p) :
+ TestRequest(c, m, p)
+ {
+ hdr["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.21 Safari/537.36";
+ hdr["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
+ hdr["Accept-Encoding"] = "gzip, deflate, sdch";
+ hdr["Accept-Language"] = "en-GB,en;q=0.8";
+ }
+
+ void standardAssertions(const char * name)
+ {
+ auto h = getResponseHeaders();
+ BOOST_REQUIRE_EQUAL(h["Status"], "200 OK");
+ BOOST_REQUIRE_EQUAL(h["Content-Type"], "text/html");
+ validateHtml(name);
+ }
+
+ void validateHtml(const char * name)
+ {
+ char buf[BUFSIZ];
+ sprintf(buf, "tidy --indent yes --wrap 0 -quiet -output %s/%s.html",
+ binDir.c_str(), name);
+ FILE * tidy = popen(buf, "w");
+ while (fwrite(buf, output.readsome(buf, BUFSIZ), 1, tidy) > 0) ;
+ BOOST_REQUIRE_EQUAL(0, pclose(tidy));
+ }
+};
+
+BOOST_AUTO_TEST_CASE( cd )
+{
+ boost::filesystem::current_path(rootDir.parent_path());
+}
+
+BOOST_FIXTURE_TEST_SUITE(ta, CoreWithDefaultRouter);
+
+BOOST_AUTO_TEST_CASE( endpointCount )
+{
+ BOOST_REQUIRE_EQUAL(22, AdHoc::PluginManager::getDefault()->getAll<IceSpider::RouteHandlerFactory>().size());
+ BOOST_REQUIRE_EQUAL(5, routes.size());
+}
+
+BOOST_AUTO_TEST_CASE( home )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( news )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/news");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( news_ruby_20_removal )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/news/2016-12-06-ruby-20-removal");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( packages )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/packages");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( packages_popular )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/packages/popular");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( packages_virtual )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/packages/virtual");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( packages_virtual_cron )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/packages/virtual/cron");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( use )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/use");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( use_gles )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/use/gles");
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_CASE( search_default )
+{
+ ChromiumRequest request(this, HttpMethod::GET, "/search");
+ request.qs["criteria"] = "default";
+ process(&request);
+ request.standardAssertions(typeid(this).name());
+}
+
+BOOST_AUTO_TEST_SUITE_END();
+
diff --git a/gentoobrowse/xslt/base.xslt b/gentoobrowse/xslt/base.xslt
index 1efd644..b1474e0 100644
--- a/gentoobrowse/xslt/base.xslt
+++ b/gentoobrowse/xslt/base.xslt
@@ -73,9 +73,9 @@
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
+ <span class="icon-bar">&#160;</span>
+ <span class="icon-bar">&#160;</span>
+ <span class="icon-bar">&#160;</span>
</button>
<a class="brand" href="/">Gentoo Browse</a>
<div class="nav-collapse collapse">
@@ -122,23 +122,23 @@
<p>Many thanks to the people behind the tech powering Gentoo Browse.</p>
<ul class="footer-links">
<li class="muted">·</li>
- <li><a href="http://www.gentoo.org/">Gentoo</a></li><wbr></wbr>
+ <li><a href="http://www.gentoo.org/">Gentoo</a></li>
<li class="muted">·</li>
- <li><a href="http://www.postgresql.org/">PostgreSQL</a></li><wbr></wbr>
+ <li><a href="http://www.postgresql.org/">PostgreSQL</a></li>
<li class="muted">·</li>
- <li><a href="http://httpd.apache.org/">Apache</a></li><wbr></wbr>
+ <li><a href="http://httpd.apache.org/">Apache</a></li>
<li class="muted">·</li>
- <li><a href="http://www.fastcgi.com/drupal/">FastCGI</a></li><wbr></wbr>
+ <li><a href="http://www.fastcgi.com/drupal/">FastCGI</a></li>
<li class="muted">·</li>
- <li><a href="http://www.w3.org/TR/xslt/">XSLT</a></li><wbr></wbr>
+ <li><a href="http://www.w3.org/TR/xslt/">XSLT</a></li>
<li class="muted">·</li>
- <li><a href="http://www.boost.org/">Boost</a></li><wbr></wbr>
+ <li><a href="http://www.boost.org/">Boost</a></li>
<li class="muted">·</li>
- <li><a href="https://zeroc.com/products/ice">ZeroC Ice</a></li><wbr></wbr>
+ <li><a href="https://zeroc.com/products/ice">ZeroC Ice</a></li>
<li class="muted">·</li>
- <li><a href="http://twitter.github.com/bootstrap/index.html">Bootstrap</a></li><wbr></wbr>
+ <li><a href="http://twitter.github.com/bootstrap/index.html">Bootstrap</a></li>
<li class="muted">·</li>
- <li><a href="http://icespider.randomdan.homeip.net/">IceSpider</a></li><wbr></wbr>
+ <li><a href="http://icespider.randomdan.homeip.net/">IceSpider</a></li>
<li class="muted">·</li>
</ul>
</div>
@@ -201,16 +201,16 @@
</a>
:
<xsl:value-of select="description" />
- <xsl:if test="/gentoo/usage/use[packageid = current()/packageid]">
- <ul>
- <xsl:for-each select="/gentoo/usage/use[packageid = current()/packageid]">
- <li>
- <xsl:value-of select="description" />
- </li>
- </xsl:for-each>
- </ul>
- </xsl:if>
</p>
+ <xsl:if test="/gentoo/usage/use[packageid = current()/packageid]">
+ <ul>
+ <xsl:for-each select="/gentoo/usage/use[packageid = current()/packageid]">
+ <li>
+ <xsl:value-of select="description" />
+ </li>
+ </xsl:for-each>
+ </ul>
+ </xsl:if>
</xsl:template>
<xsl:template match="text()" name="split">
diff --git a/gentoobrowse/xslt/categories.xslt b/gentoobrowse/xslt/categories.xslt
index c800717..553abe5 100644
--- a/gentoobrowse/xslt/categories.xslt
+++ b/gentoobrowse/xslt/categories.xslt
@@ -29,7 +29,8 @@
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute>
- <i class="icon-chevron-right"></i> <xsl:value-of select="name" />
+ <i class="icon-chevron-right">&#160;</i>
+ <xsl:value-of select="name" />
</a>
</li>
</xsl:for-each>
diff --git a/gentoobrowse/xslt/category.xslt b/gentoobrowse/xslt/category.xslt
index 622b9eb..117113c 100644
--- a/gentoobrowse/xslt/category.xslt
+++ b/gentoobrowse/xslt/category.xslt
@@ -28,14 +28,13 @@
<xsl:template match="/gentoo/packages">
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav">
- <li>
- </li>
</ul>
</div>
<div class="span9">
- <p>
- </p>
- <xsl:apply-templates select="/gentoo/packages/package" />
+ <section>
+ <h2 class="page-header">Package list</h2>
+ <xsl:apply-templates select="/gentoo/packages/package" />
+ </section>
</div>
</xsl:template>
</xsl:stylesheet>
diff --git a/gentoobrowse/xslt/home.xslt b/gentoobrowse/xslt/home.xslt
index bc7e657..4fa6046 100644
--- a/gentoobrowse/xslt/home.xslt
+++ b/gentoobrowse/xslt/home.xslt
@@ -36,7 +36,7 @@
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="date:date(timestamp)" /></xsl:attribute>
- <i class="icon-chevron-right"></i>
+ <i class="icon-chevron-right">&#160;</i>
<xsl:call-template name="humanDate">
<xsl:with-param name="date" select="timestamp" />
</xsl:call-template>
diff --git a/gentoobrowse/xslt/news.xslt b/gentoobrowse/xslt/news.xslt
index 76b5a3a..4126aad 100644
--- a/gentoobrowse/xslt/news.xslt
+++ b/gentoobrowse/xslt/news.xslt
@@ -23,6 +23,7 @@
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="newsid" /></xsl:attribute>
+ <i class="icon-chevron-right">&#160;</i>
<xsl:call-template name="humanDate">
<xsl:with-param name="date" select="posted" />
</xsl:call-template>
diff --git a/gentoobrowse/xslt/package.xslt b/gentoobrowse/xslt/package.xslt
index f435ea3..a89fef7 100644
--- a/gentoobrowse/xslt/package.xslt
+++ b/gentoobrowse/xslt/package.xslt
@@ -34,29 +34,29 @@
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav">
<xsl:if test="/gentoo/package/summary != ''">
- <li><a href="#summary"><i class="icon-chevron-right"/>Summary</a></li>
+ <li><a href="#summary"><i class="icon-chevron-right">&#160;</i>Summary</a></li>
</xsl:if>
- <li><a href="#versions"><i class="icon-chevron-right"/>Versions</a></li>
+ <li><a href="#versions"><i class="icon-chevron-right">&#160;</i>Versions</a></li>
<xsl:if test="/gentoo/uses/use">
- <li><a href="#uses"><i class="icon-chevron-right"/>USE flags</a></li>
+ <li><a href="#uses"><i class="icon-chevron-right">&#160;</i>USE flags</a></li>
</xsl:if>
<xsl:if test="/gentoo/dependencies/package">
- <li><a href="#deps"><i class="icon-chevron-right"/>Dependencies</a></li>
+ <li><a href="#deps"><i class="icon-chevron-right">&#160;</i>Dependencies</a></li>
</xsl:if>
<xsl:if test="/gentoo/rdependencies/package">
- <li><a href="#rdeps"><i class="icon-chevron-right"/>Runtime dependencies</a></li>
+ <li><a href="#rdeps"><i class="icon-chevron-right">&#160;</i>Runtime dependencies</a></li>
</xsl:if>
<xsl:if test="/gentoo/depending/package">
- <li><a href="#depees"><i class="icon-chevron-right"/>Depending packages</a></li>
+ <li><a href="#depees"><i class="icon-chevron-right">&#160;</i>Depending packages</a></li>
</xsl:if>
<xsl:if test="/gentoo/bugs/bug">
- <li><a href="#bugs"><i class="icon-chevron-right"/>Open bugs</a></li>
+ <li><a href="#bugs"><i class="icon-chevron-right">&#160;</i>Open bugs</a></li>
</xsl:if>
<xsl:if test="/gentoo/masks/mask">
- <li><a href="#masks"><i class="icon-chevron-right"/>Masks</a></li>
+ <li><a href="#masks"><i class="icon-chevron-right">&#160;</i>Masks</a></li>
</xsl:if>
<xsl:if test="/gentoo/changelog/entry">
- <li><a href="#changelog"><i class="icon-chevron-right"/>Change log</a></li>
+ <li><a href="#changelog"><i class="icon-chevron-right">&#160;</i>Change log</a></li>
</xsl:if>
<xsl:if test="user">
<li>
@@ -64,12 +64,12 @@
<xsl:attribute name="href">javascript:track(<xsl:value-of select="/gentoo/package/packageid" />);</xsl:attribute>
<xsl:if test="tracked = 'true'">
<xsl:attribute name="style">display: none</xsl:attribute>
- </xsl:if><i class="icon-eye-close"/>Follow</a>
+ </xsl:if><i class="icon-eye-close">&#160;</i>Follow</a>
<a id="dountrack">
<xsl:attribute name="href">javascript:untrack(<xsl:value-of select="/gentoo/package/packageid" />);</xsl:attribute>
<xsl:if test="tracked = 'false'">
<xsl:attribute name="style">display: none</xsl:attribute>
- </xsl:if><i class="icon-eye-open"/>Unfollow</a>
+ </xsl:if><i class="icon-eye-open">&#160;</i>Unfollow</a>
</li>
</xsl:if>
</ul>
diff --git a/gentoobrowse/xslt/popular.xslt b/gentoobrowse/xslt/popular.xslt
index 9e11307..5e45e11 100644
--- a/gentoobrowse/xslt/popular.xslt
+++ b/gentoobrowse/xslt/popular.xslt
@@ -34,7 +34,8 @@
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute>
- <i class="icon-chevron-right"></i> <xsl:value-of select="name" />
+ <i class="icon-chevron-right">&#160;</i>
+ <xsl:value-of select="name" />
</a>
</li>
</xsl:for-each>
diff --git a/gentoobrowse/xslt/search.xslt b/gentoobrowse/xslt/search.xslt
index 5ec8c83..de5db9e 100644
--- a/gentoobrowse/xslt/search.xslt
+++ b/gentoobrowse/xslt/search.xslt
@@ -23,16 +23,16 @@
<xsl:if test="/gentoo/packages|bugs|news/*">
<ul class="nav nav-list bs-docs-sidenav">
<xsl:if test="/gentoo/packages/*">
- <li><a href="#packages"><i class="icon-chevron-right"></i>Packages</a></li>
+ <li><a href="#packages"><i class="icon-chevron-right">&#160;</i>Packages</a></li>
</xsl:if>
<xsl:if test="/gentoo/uses/*">
- <li><a href="#uses"><i class="icon-chevron-right"></i>Use flags</a></li>
+ <li><a href="#uses"><i class="icon-chevron-right">&#160;</i>Use flags</a></li>
</xsl:if>
<xsl:if test="/gentoo/bugs/*">
- <li><a href="#bugs"><i class="icon-chevron-right"></i>Bugs</a></li>
+ <li><a href="#bugs"><i class="icon-chevron-right">&#160;</i>Bugs</a></li>
</xsl:if>
<xsl:if test="/gentoo/news/*">
- <li><a href="#news"><i class="icon-chevron-right"></i>News</a></li>
+ <li><a href="#news"><i class="icon-chevron-right">&#160;</i>News</a></li>
</xsl:if>
</ul>
</xsl:if>
diff --git a/gentoobrowse/xslt/use-detail.xslt b/gentoobrowse/xslt/use-detail.xslt
index 6d114ce..d37b245 100644
--- a/gentoobrowse/xslt/use-detail.xslt
+++ b/gentoobrowse/xslt/use-detail.xslt
@@ -36,7 +36,7 @@
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="name" /></xsl:attribute>
- <i class="icon-chevron-right"></i> <xsl:value-of select="name" />
+ <i class="icon-chevron-right">&#160;</i> <xsl:value-of select="name" />
</a>
</li>
</xsl:for-each>
diff --git a/gentoobrowse/xslt/use.xslt b/gentoobrowse/xslt/use.xslt
index e8c5ea8..3b148a2 100644
--- a/gentoobrowse/xslt/use.xslt
+++ b/gentoobrowse/xslt/use.xslt
@@ -25,7 +25,7 @@
<li>
<a>
<xsl:attribute name="href">#<xsl:value-of select="$char" /></xsl:attribute>
- <i class="icon-chevron-right"></i> <xsl:value-of select="$char" />
+ <i class="icon-chevron-right">&#160;</i> <xsl:value-of select="$char" />
</a>
</li>
</xsl:for-each>