Changes between Version 8 and Version 9 of Tests
- Timestamp:
- Sep 2, 2013, 4:59:59 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tests
v8 v9 1 1 === Intro === 2 2 3 The MacPorts testing framework uses tcltest ![0] for its unit tests as well as regression tests.3 The MacPorts testing framework uses [[http://wiki.tcl.tk/1502 | tcltest]] for its unit tests as well as regression tests. 4 4 Maintainer: marius [at] macports.org 5 5 … … 9 9 * make test 10 10 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.11 Each '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. 12 12 The file can be used also to: 13 * run all tests: 13 * run all tests: ' tclsh test.tcl ' 14 14 * get debug info: ' tclsh test.tcl -debug \[0-3\] ' 15 15 * list individual test files: ' tclsh test.tcl -l ' … … 26 26 27 27 * 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]]) 29 29 * each file in a module has a corresponding test file (.test extension) in the ‘tests/’ directory 30 30 * each proc in a file has a corresponding test case (test proc_name) in the … … 55 55 56 56 # source/require tested/needed files 57 source ../../port1.0/portutil.tcl 57 # source ../../port1.0/portutil.tcl 58 package require portutil 1.0 58 59 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 62 makeDirectory $pwd/tmpdir 63 makeDirectory $pwd/tmpdir/share 64 makeDirectory $pwd/tmpdir/var/macports/registry 65 set fd [open $pwd/tmpdir/macports.conf w+] 66 puts $fd "portdbpath $pwd/tmpdir/var/macports" 67 puts $fd "prefix $pwd/tmpdir" 68 puts $fd "variants_conf $pwd/tmpdir/variants.conf" 69 puts $fd "sources_conf $pwd/sources.conf" 70 puts $fd "applications_dir $pwd/tmpdir/Applications" 71 puts $fd "frameworks_dir $pwd/tmpdir/Library/Frameworks" 72 close $fd 73 set env(PORTSRC) $pwd/tmpdir/macports.conf 74 file link -symbolic $pwd/tmpdir/share/macports $macports::autoconf::prefix/share/macports 75 close [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 64 84 65 85 … … 106 126 === Resources === 107 127 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]]\\