Changes between Version 8 and Version 9 of Tests


Ignore:
Timestamp:
Sep 2, 2013, 4:59:59 PM (11 years ago)
Author:
marius@…
Comment:

more improvements

Legend:

Unmodified
Added
Removed
Modified
  • Tests

    v8 v9  
    11=== Intro ===
    22
    3 The MacPorts testing framework uses tcltest ![0] for its unit tests as well as regression tests.
     3The MacPorts testing framework uses [[http://wiki.tcl.tk/1502 | tcltest]] for its unit tests as well as regression tests.
    44Maintainer: marius [at] macports.org
    55
     
    99* make test
    1010
    11 Each 'tests/' directory has a 'test.tcl' file, used by the make target to run all tests and format the output, making it easy to read.
     11Each 'tests/' directory has a [[https://trac.macports.org/browser/branches/gsoc13-tests/src/macports1.0/tests/test.tcl | test.tcl]] file, used by the make target to run all tests and format the output, making it easy to read.
    1212The file can be used also to:
    13 * run all tests:                    ' tclsh test.tcl '
     13* run all tests:                ' tclsh test.tcl '
    1414* get debug info:               ' tclsh test.tcl -debug \[0-3\] '
    1515* list individual test files:   ' tclsh test.tcl -l '
     
    2626
    2727* regression tests have their own directory, found in ' trunk/base/tests/ '
    28 * each module of MacPorts (port1.0, macports1.0, package1.0) has its own ‘tests/’ directory where the test files are located and also additional files needed (Portfile, test.tcl)
     28* each module of MacPorts (port1.0, macports1.0, package1.0) has its own ‘tests/’ directory where the test files are located and also additional files needed ([[https://trac.macports.org/browser/branches/gsoc13-tests/src/macports1.0/tests/Portfile | Portfile]], [[https://trac.macports.org/browser/branches/gsoc13-tests/src/macports1.0/tests/test.tcl | test.tcl]])
    2929* each file in a module has a corresponding test file (.test extension) in the ‘tests/’ directory
    3030* each proc in a file has a corresponding test case (test proc_name) in the
     
    5555
    5656# source/require tested/needed files
    57 source ../../port1.0/portutil.tcl
     57# source ../../port1.0/portutil.tcl
     58package require portutil 1.0
    5859
    59 # additional procs needed for testing
    60 proc registry_exists {name version {revision 0} {variants ""}} {
    61         global macports::registry.format
    62         return [${macports::registry.format}::entry_exists $name $version $revision $variants]
    63 }
     60# use custom macports.conf and sources.conf
     61# you need to provide the sources.conf (see additional files) file
     62makeDirectory $pwd/tmpdir
     63makeDirectory $pwd/tmpdir/share
     64makeDirectory $pwd/tmpdir/var/macports/registry
     65set fd [open $pwd/tmpdir/macports.conf w+]
     66puts $fd "portdbpath $pwd/tmpdir/var/macports"
     67puts $fd "prefix $pwd/tmpdir"
     68puts $fd "variants_conf $pwd/tmpdir/variants.conf"
     69puts $fd "sources_conf $pwd/sources.conf"
     70puts $fd "applications_dir $pwd/tmpdir/Applications"
     71puts $fd "frameworks_dir $pwd/tmpdir/Library/Frameworks"
     72close $fd
     73set env(PORTSRC) $pwd/tmpdir/macports.conf
     74file link -symbolic $pwd/tmpdir/share/macports $macports::autoconf::prefix/share/macports
     75close [open $pwd/tmpdir/variants.conf w+]
     76
     77# if you need to use procs from macports namespace, that are just aliases, you can
     78# always source library.tcl (see additional files) which provides a copy macports::worker_init
     79# without sub-interpreters; it also sets some important environment variables like
     80# os.platform, os.major, os.arch, workpath, destpath, portpath
     81# some other option would be to get the $workername from a $mport and use it directly
     82
     83# additional procs needed for testing go before the actual test cases
    6484
    6585
     
    106126=== Resources ===
    107127
    108 ![0] - [[http://wiki.tcl.tk/1502 | Tcltest official wiki page]]\\
    109 ![1] - [[http://web.archive.org/web/20080617153002/www.tclscripting.com/articles/apr06/article1.html | Getting started with tcltest]]\\
    110 ![2] - [[http://www.tcl.tk/man/tcl8.5/TclCmd/tcltest.htm | Official tcltest documentation]]\\
     128* [[http://wiki.tcl.tk/1502 | Tcltest official wiki page]]\\
     129* [[http://web.archive.org/web/20080617153002/www.tclscripting.com/articles/apr06/article1.html | Getting started with tcltest]]\\
     130* [[http://www.tcl.tk/man/tcl8.5/TclCmd/tcltest.htm | Official tcltest documentation]]\\