# Copyright (c) 2002-2008 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: ResultViewer.pm,v 1.2 2011/06/16 12:55:13 andrews Exp $ package Bivio::Util::ResultViewer; use strict; use Bivio::Base 'Bivio::ShellUtil'; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.2 $ =~ /\d+/g); my($root) = "$ENV{HOME}/src/perl/$ENV{BROOT}/Test/t"; my($log_dir_name) = $root . '/log'; my($index_page_name) = $log_dir_name . '/index.html'; my($our_name) = __PACKAGE__ =~ /::(\w+)$/; sub USAGE { return <<'EOF'; View acceptance test output in browser usage: b ResultViewer [options] command [args...] commands: generate [test-name ...] -- (re)process results from one or more tests Default is all tests EOF } my($css) = <<'EOF'; EOF my($javascript) = <<'EOF'; EOF my($frameset_html) = <<'EOF';
EOF sub generate { my($self, @names) = (shift, @_); my($dir); opendir($dir, $log_dir_name) || return 'Cannot open directory: ' . $log_dir_name; my(@subdirs)= grep {/^[^.]/ && -d "$log_dir_name/$_"} readdir($dir); closedir($dir); if (int(@names)) { foreach my $name (@names) { return 'no test results for ' . $name unless grep({$name eq $_} @subdirs); } } else { @names = @subdirs; } my($rows) = "