#!/usr/bin/env python2.1

#    Copyright (C) 2001 Artifex Software Inc.
# 
# This software is provided AS-IS with no warranty, either express or
# implied.
# 
# This software is distributed under license and may not be copied,
# modified or distributed except as expressly authorized under the terms
# of the license contained in the file LICENSE in this distribution.
# 
# For more information about licensing, please refer to
# http://www.ghostscript.com/licensing/. For information on
# commercial licensing, go to http://www.artifex.com/licensing/ or
# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
# San Rafael, CA  94903, U.S.A., +1(415)492-9861.

# $Id: run_regression,v 1.7 2002/09/18 19:15:30 jack Exp $

#
# run_regression
#
# runs ghostscript regression tests

import os
import gstestutils
import gsconf, gstestgs, gsparamsets
import check_all
import gscheck_all

# get a list of test files
comparefiles = os.listdir(gsconf.comparefiledir)

suite = gstestutils.GSTestSuite()

# add compare tests
def add_compare_test(suite, f, device, dpi, band):
        suite.addTest(gstestgs.GSCompareTestCase(gs=gsconf.comparegs,
						 file=gsconf.comparefiledir + f,
						 device=device, dpi=dpi, band=band, gsoptions=gsconf.compareoptions,
						 log_stdout=gsconf.log_stdout, log_stderr=gsconf.log_stderr, track_daily=1))

for f in comparefiles:
    if f[-3:] == '.ps' or f[-4:] == '.pdf' or f[-4:] == '.eps':
	for params in gsparamsets.testparamsets:
            add_compare_test(suite, f, params.device, params.resolution, params.banding)

# Add other tests based on running Ghostscript.
gscheck_all.addTests(suite, gsroot=gsconf.gsroot)

# Add tests not based on actually running Ghostscript.
check_all.addTests(suite, gsroot=gsconf.gsroot)

# run all the tests
runner = gstestutils.GSTestRunner(verbosity=2)
result = runner.run(suite)

