Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename masstest to smoker. Make it generate JSON instead of an HTML file

  • Loading branch information...
commit ad8de415b495939d46b2b8f748e17771695db0e8 1 parent 7eed037
@tadzik authored
Showing with 54 additions and 184 deletions.
  1. +0 −184 masstest
  2. +54 −0 smoker
View
184 masstest
@@ -1,184 +0,0 @@
-#!/usr/bin/env perl6
-use Panda;
-use Shell::Command;
-
-#run with PERL6LIB=ext:lib:$PWD/installlib/lib perl6 bin/masstest
-
-my $tmpl-main = '
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Emmentaler</title>
- <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
- <style type="text/css">
- .implemented, .implemented a {
- background-color: #3c3;
- color: white;
- }
- .partial , .partial a {
- background-color: #fb4;
- color: #333;
- }
- .missing , .missing a {
- background-color: #f55;
- color: white;
- }
- .unknown , .unknown a {
- background-color: #ccc;
- color: white;
- }
- .implemented, .partial, .missing, .unknown {
- text-align: center;
- width: 150px;
- font-weight: bold;
- font-family: monospace;
- font-size: 18px;
- -moz-border-radius: 15px;
- border-radius: 15px;
- }
- .subsection {
- padding-top: 1em;
- text-align: left;
- }
- .minor {
- font-size: smaller;
- font-style: italic;
- }
- .footnote_link {
- font-size: 70%%;
- position: absolute;
- }
- :target {
- background-color: #FFFF66;
- }
- </style>
-
-</head>
-<body>
- <img src="http://perl6.org/camelia-logo-small.png" alt="Camelia, the Perl 6 bug" align="right">
-
- <h1>Emmentaler</h1>
-
- <h2>Modules (on Rakudo)</h2>
- <table>
- <thead>
- <tr>
- <th>Module</th>
-
- <th>Prereqs ok</th>
-
- <th>Builds</th>
-
- <th>Tests</th>
-
- <th>Additional information</th>
- </tr>
- </thead>
- <tbody>
-
-%s
-
- </tbody>
- </table>
-
- <p>%s modules OK, %s not</p>
-
-</body>
-</html>
-';
-
-my $tmpl-project = '
-<tr><td style="border-bottom:1px dotted #98CAEB"><a href="%s">%s</a></td>
-<td><div class="%s">%s</div></td>
-<td><div class="%s">%s</div></td>
-<td><div class="%s">%s</div></td>
-<td>%s</td>
-</tr>
-';
-
-sub good { 'implemented', '+' }
-sub bad { 'missing', '-' }
-sub unknown { 'unknown', '?' }
-
-sub url(Pies::Project $p) {
- if $p.metainfo<source-url> ne "" {
- $p.metainfo<source-url>.subst(/^git/, 'http').subst(/\.git$/, '')
- } else {
- ''
- }
-}
-
-multi gen-result(Pies::Project $p, True) {
- sprintf $tmpl-project, url($p), $p.name, good(), good(), good(), ""
-}
-
-multi gen-result(Pies::Project $p, X::Panda $ex) {
- my (@pre, @build, @test);
-
- given $ex.stage {
- when 'resolve' | 'fetch' {
- @pre = bad();
- @build = @test = unknown();
- }
- when 'build' {
- @pre = good();
- @build = bad();
- @test = unknown();
- }
- when 'test' {
- @pre = @build = good();
- @test = bad();
- }
- }
-
- my @args = (url($p), $p.name, @pre, @build, @test, $ex.description).flat;
-
- sprintf $tmpl-project, |@args;
-}
-
-sub MAIN ($projectsdir = "projects.json.small") {
- my $good-count = 0;
- my $bad-count = 0;
-
- try mkdir "installlib";
- my $panda = Panda.new(
- srcdir => "masstest/pandadir/src",
- destdir => "{cwd}/installlib",
- statefile => "masstest/pandadir/state",
- projectsfile => $projectsdir,
- );
-
- my %log;
-
- for $panda.ecosystem.project-list -> $p {
- my $x = $panda.ecosystem.get-project($p);
- # don't waste time if it has already been installed once
- if $panda.ecosystem.project-get-state($x) ne 'absent'
- or $p eq "panda" {
- $good-count++;
- %log{$p} = True;
- next;
- }
- try $panda.resolve($p);
- if defined $! {
- $bad-count++;
- %log{$p} = $!;
- } else {
- %log{$p} = True;
- }
- }
-
- shell 'rm -rf masstest';
- shell 'rm -rf installlib/*';
-
- my $contents;
- for %log.keys.sort(*.lc) -> $m {
- $contents ~= gen-result($panda.ecosystem.get-project($m), %log{$m});
- }
-
- my $html = open('index.html', :w);
- $html.print(sprintf $tmpl-main, $contents, $good-count, $bad-count);
- $html.close;
-}
View
54 smoker
@@ -0,0 +1,54 @@
+#!/usr/bin/env perl6
+use Panda;
+use Shell::Command;
+use JSON::Tiny;
+
+multi gen-result($) {
+ { prereq => True, build => True, test => True }
+}
+
+multi gen-result(X::Panda $ex) {
+ return do given $ex.stage {
+ when 'resolve' | 'fetch' {
+ { prereq => False }
+ }
+ when 'build' {
+ { prereq => True, build => False }
+ }
+ when 'test' {
+ { prereq => True, build => True, test => False }
+ }
+ }
+}
+
+sub MAIN ($projectsfile) {
+ try mkdir "installlib";
+ %*ENV<PERL6LIB> = "{cwd}/installlib/lib:" ~ %*ENV<PERL6LIB>;
+ my $panda = Panda.new(
+ srcdir => "{cwd}/masstest/pandadir/src",
+ destdir => "{cwd}/installlib",
+ statefile => "{cwd}/masstest/pandadir/state",
+ projectsfile => $projectsfile,
+ );
+
+ my %log;
+
+ for $panda.ecosystem.project-list -> $p {
+ my $x = $panda.ecosystem.get-project($p);
+ # don't waste time if it has already been installed once
+ if $panda.ecosystem.project-get-state($x) ne 'absent' {
+ %log{$p} = gen-result(Any);
+ next;
+ }
+ try $panda.resolve($p);
+ %log{$p} = gen-result($! // 'chocolate cake');
+ }
+
+ shell 'rm -rf masstest/';
+ shell 'rm -rf installlib/';
+
+ given open('results.json', :w) {
+ .say: to-json %log;
+ .close;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.