Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix portmpkg.test
Work without being able to sync the user's ports tree.
Mock getportresourcepath.

(cherry picked from commit 90893e5)
(cherry picked from commit c340033)
  • Loading branch information
jmroot committed Feb 17, 2017
1 parent ce493cb commit 34c16b3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/package1.0/Makefile.in
Expand Up @@ -22,7 +22,6 @@ distclean:: clean
rm -f Makefile

test::
-$(prefix)/bin/port sync
$(TCLSH) $(srcdir)/../tests/test.tcl -nocolor

install:: all
Expand Down
27 changes: 17 additions & 10 deletions src/package1.0/tests/library.tcl
@@ -1,34 +1,41 @@
proc env_init {} {
global os.platform os.major os.arch epoch destpath package.destpath configure.build_arch
global subport version revision package.flat maintainers description categories
global supported_archs porturl workpath distname license filespath portpath pwd
global name
global os.platform os.major os.arch epoch destpath package.destpath build_arch configure.build_arch \
subport version revision package.flat maintainers description categories homepage \
supported_archs porturl workpath distname license filespath portpath pwd name

set os.platform darwin
set os.major 9
set os.arch i386
set epoch 1
set epoch 0

set workpath $pwd/work
set workpath $pwd/work
set destpath $pwd/pkg
set portpath $pwd
set portdbpath $pwd/dbpath
set filespath $pwd/files
set configure.build_arch build_arch
set build_arch i386
set configure.build_arch $build_arch
set package.destpath $pwd/pkg

set name fondu
set name fondu
set subport fondu
set version 060102
set distname fondu_src-060102
set revision 1
set license MIT
set license BSD
set package.flat no
set maintainers {test@macports.org}
set description test.description
set categories test
set supported_archs noarch
set porturl "http://fondu.sourceforge.net/"
set homepage "http://fondu.sourceforge.net/"
set porturl "file://${pwd}"

# mock mport_lookup, it normally needs a PortIndex
proc mport_lookup {portname} {
global porturl
return [list $portname [list variants universal portdir print/${portname} description {A set of programs to interconvert between Mac font formats and pfb, ttf, otf and bdf files on UNIX.} homepage http://fondu.sourceforge.net/ epoch 0 platforms darwin name $portname license BSD maintainers nomaintainer version 060102 categories print revision 1 porturl $porturl]]
}
}

##
Expand Down
23 changes: 15 additions & 8 deletions src/package1.0/tests/portmpkg.test
Expand Up @@ -18,20 +18,26 @@ package require portpkg 1.0
source ./library.tcl
macports_worker_init

# mock getportresourcepath, tests should be able to operate without a ports tree
proc getportresourcepath {url {path {}} {fallback yes}} {
global pwd
return [file join $pwd $path]
}

test mpkg_main {
Port mpkg main unit test.
} -constraints {
darwin
} -setup {
global os.platform os.major os.arch destpath package.destpath configure.build_arch
global subport version revision package.flat maintainers description categories
global supported_archs porturl
global os.platform os.major os.arch destpath package.destpath configure.build_arch \
subport version revision package.flat maintainers description categories \
supported_archs porturl pwd
env_init

file mkdir $destpath
close [open $destpath/fondu-060102_1.pkg w+]

file mkdir ${pwd}/port1.0/package
close [open ${pwd}/port1.0/package/background.tiff w+]
} -body {
if {[portmpkg::mpkg_main] != 0} {
return "FAIL: cannot create pkg"
Expand All @@ -52,16 +58,17 @@ test mpkg_main {

} -cleanup {
file delete -force $destpath

global pwd
file delete -force ${pwd}/port1.0
} -result "Package mpkg successful."


test make_dependency_list {
Make dependency list unit test.
} -setup {
global os.platform os.major os.arch destpath package.destpath configure.build_arch
global subport version revision package.flat maintainers description categories
global supported_archs porturl
global os.platform os.major os.arch destpath package.destpath configure.build_arch \
subport version revision package.flat maintainers description categories \
supported_archs porturl
env_init

set destination $pwd/destination
Expand Down

0 comments on commit 34c16b3

Please sign in to comment.