diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 297ce49f7..eea0ff2a2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -33,14 +33,14 @@ jobs: run: | set -eu make -j$(sysctl -n hw.activecpu) - - name: Install MacPorts Base - run: | - set -eu - sudo make install - name: Test MacPorts Base run: | set -eu LLVM_PROFILE_FILE="$PWD/cov-%p.profraw" make test + - name: Install MacPorts Base + run: | + set -eu + sudo make install - name: Report Coverage run: | set -eu diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 679d164d4..fc30f0d08 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -56,15 +56,15 @@ jobs: Linux) make -j$(nproc) ;; esac - - name: Install MacPorts Base - run: | - set -eu - sudo make install - name: Test MacPorts Base if: startsWith(matrix.os,'macos') run: | set -eu make test + - name: Install MacPorts Base + run: | + set -eu + sudo make install - name: Deploy man pages to web if: vars.MP_RELEASE_BRANCH == github.ref_name && startsWith(matrix.os,'ubuntu') env: diff --git a/.gitignore b/.gitignore index aa2d45fb9..59320f2bc 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ src/**/*.dylib src/**/*.dSYM tests/test.tcl +tests/test-tclsh tests/test/library.tcl tests/test/trace/test.tcl diff --git a/Mk/macports.autoconf.mk.in b/Mk/macports.autoconf.mk.in index 2b76c8c75..34d3f9089 100644 --- a/Mk/macports.autoconf.mk.in +++ b/Mk/macports.autoconf.mk.in @@ -35,6 +35,7 @@ LN_S = @LN_S@ XCODEBUILD = @XCODEBUILD@ INTREE_TCLSH = @INTREE_TCLSH@ +TEST_TCLSH = @TEST_TCLSH@ TCLSH = @TCLSH@ TCL_PACKAGE_PATH = @TCL_PACKAGE_PATH@ TCL_PREFIX = @TCL_PREFIX@ diff --git a/configure b/configure index 7ffb9aa38..b534a7561 100755 --- a/configure +++ b/configure @@ -632,6 +632,7 @@ LIBOBJS SQLITE3_LIBNAME SQLITE3_CPPFLAGS INCLUDES +TEST_TCLSH INTREE_TCLSH TCLSH TCL_PACKAGE_PATH @@ -10197,6 +10198,7 @@ SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS} SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX} TCLSH=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} INTREE_TCLSH=`(cd vendor; pwd)`/tclsh +TEST_TCLSH=`(cd tests; pwd)`/test-tclsh TCL_PACKAGE_PATH="$macports_libexec_dir/lib" @@ -10212,6 +10214,7 @@ TCL_PACKAGE_PATH="$macports_libexec_dir/lib" + INCLUDES="-I.. -I. $INCLUDES" @@ -10243,6 +10246,8 @@ ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/ ac_config_files="$ac_config_files vendor/tclsh" +ac_config_files="$ac_config_files tests/test-tclsh" + ac_config_files="$ac_config_files src/cxx_stdlib_overridden.tcl" ac_config_files="$ac_config_files src/dedup_portfiles.tcl" @@ -10939,6 +10944,7 @@ do "vendor/critcl/lib/critcl/Config") CONFIG_FILES="$CONFIG_FILES vendor/critcl/lib/critcl/Config" ;; "vendor/signify-osx/autoconf.mk") CONFIG_FILES="$CONFIG_FILES vendor/signify-osx/autoconf.mk" ;; "vendor/tclsh") CONFIG_FILES="$CONFIG_FILES vendor/tclsh" ;; + "tests/test-tclsh") CONFIG_FILES="$CONFIG_FILES tests/test-tclsh" ;; "src/cxx_stdlib_overridden.tcl") CONFIG_FILES="$CONFIG_FILES src/cxx_stdlib_overridden.tcl" ;; "src/dedup_portfiles.tcl") CONFIG_FILES="$CONFIG_FILES src/dedup_portfiles.tcl" ;; "src/images_to_archives.tcl") CONFIG_FILES="$CONFIG_FILES src/images_to_archives.tcl" ;; @@ -11501,6 +11507,7 @@ printf '%s\n' "$as_me: $ac_file is unchanged" >&6;} case $ac_file$ac_mode in "vendor/tclsh":F) chmod +x vendor/tclsh ;; + "tests/test-tclsh":F) chmod +x tests/test-tclsh ;; "src/cxx_stdlib_overridden.tcl":F) chmod +x src/cxx_stdlib_overridden.tcl ;; "src/dedup_portfiles.tcl":F) chmod +x src/dedup_portfiles.tcl ;; "src/images_to_archives.tcl":F) chmod +x src/images_to_archives.tcl ;; diff --git a/configure.ac b/configure.ac index 81c780df0..f2502510d 100644 --- a/configure.ac +++ b/configure.ac @@ -546,6 +546,7 @@ SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS} SHLIB_SUFFIX=${TCL_SHLIB_SUFFIX} TCLSH=${TCL_EXEC_PREFIX}/bin/tclsh${TCL_VERSION} INTREE_TCLSH=`(cd vendor; pwd)`/tclsh +TEST_TCLSH=`(cd tests; pwd)`/test-tclsh TCL_PACKAGE_PATH="$macports_libexec_dir/lib" AC_SUBST(SHLIB_LD) @@ -560,6 +561,7 @@ AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCLSH) AC_SUBST(INTREE_TCLSH) +AC_SUBST(TEST_TCLSH) INCLUDES="-I.. -I. $INCLUDES" AC_SUBST(INCLUDES) @@ -618,6 +620,7 @@ AC_CONFIG_FILES([ ]) AC_CONFIG_FILES([vendor/tclsh], [chmod +x vendor/tclsh]) +AC_CONFIG_FILES([tests/test-tclsh], [chmod +x tests/test-tclsh]) AC_CONFIG_FILES([src/cxx_stdlib_overridden.tcl], [chmod +x src/cxx_stdlib_overridden.tcl]) AC_CONFIG_FILES([src/dedup_portfiles.tcl], [chmod +x src/dedup_portfiles.tcl]) AC_CONFIG_FILES([src/images_to_archives.tcl], [chmod +x src/images_to_archives.tcl]) diff --git a/src/darwintracelib1.0/tests/Makefile.in b/src/darwintracelib1.0/tests/Makefile.in index ca0026c92..e440bb3f5 100644 --- a/src/darwintracelib1.0/tests/Makefile.in +++ b/src/darwintracelib1.0/tests/Makefile.in @@ -47,7 +47,7 @@ distclean:: clean rm -f Makefile test:: $(BINS) - $(foreach test,$(TESTS),DARWINTRACE_SIP_WORKAROUND_PATH=@DARWINTRACE_SIP_WORKAROUND_PATH@ LC_ALL=C $(TCLSH) "$(srcdir)/$(test)";) + $(foreach test,$(TESTS),DARWINTRACE_SIP_WORKAROUND_PATH=@DARWINTRACE_SIP_WORKAROUND_PATH@ LC_ALL=C $(TEST_TCLSH) "$(srcdir)/$(test)";) ifeq (,$(findstring clean,$(MAKECMDGOALS))) # Include dependency information diff --git a/src/macports1.0/Makefile.in b/src/macports1.0/Makefile.in index 8cdd39fa1..b329c4b0b 100644 --- a/src/macports1.0/Makefile.in +++ b/src/macports1.0/Makefile.in @@ -25,7 +25,7 @@ SHLIB_LDFLAGS+= -install_name ${INSTALLDIR}/${SHLIB_NAME} endif test:: - $(TCLSH) $(srcdir)/../tests/test.tcl -nocolor + $(TEST_TCLSH) $(srcdir)/../tests/test.tcl -nocolor distclean:: clean rm -f macports_autoconf.tcl macports_test_autoconf.tcl ${SHLIB_NAME} diff --git a/src/macports1.0/macports_test_autoconf.tcl.in b/src/macports1.0/macports_test_autoconf.tcl.in index 274bc048e..adfb9b37b 100644 --- a/src/macports1.0/macports_test_autoconf.tcl.in +++ b/src/macports1.0/macports_test_autoconf.tcl.in @@ -33,4 +33,5 @@ namespace eval macports::autoconf { variable prefix "@prefix@" variable os_platform "@OS_PLATFORM@" + variable top_srcdir "@abs_top_srcdir@" } diff --git a/src/macports1.0/tests/init_tmp_prefix.tcl b/src/macports1.0/tests/init_tmp_prefix.tcl new file mode 100644 index 000000000..dc1e8499e --- /dev/null +++ b/src/macports1.0/tests/init_tmp_prefix.tcl @@ -0,0 +1,35 @@ +# Set up a custom environment with its own configuration. +# Shared by macports1.0, port1.0, and package1.0 test suites. +proc init_tmp_prefix {srcpath dstpath} { + global env + + umask 022 + # use custom macports.conf and sources.conf + makeDirectory $dstpath + makeDirectory $dstpath/share/macports/install + makeDirectory $dstpath/var/macports/registry + makeDirectory $dstpath/var/macports/distfiles + set fd [open $dstpath/macports.conf w+] + puts $fd "portdbpath $dstpath/var/macports" + puts $fd "prefix $dstpath" + puts $fd "variants_conf $dstpath/variants.conf" + puts $fd "sources_conf $srcpath/sources.conf" + puts $fd "applications_dir $dstpath/Applications" + puts $fd "frameworks_dir $dstpath/Library/Frameworks" + puts $fd "extra_env TCLLIBPATH" + close $fd + + # Populate share/macports from the source tree instead of the + # installed prefix, so tests can run fully in-tree. + set top $macports::autoconf::top_srcdir + file copy $top/macports-pubkey.pem $dstpath/share/macports/ + file copy $top/setupenv.bash $dstpath/share/macports/ + file copy $top/doc/base.mtree $dstpath/share/macports/install/ + file copy $top/doc/prefix.mtree $dstpath/share/macports/install/ + file copy $top/doc/macosx.mtree $dstpath/share/macports/install/ + file copy $top/keys $dstpath/share/macports/ + + close [open $dstpath/variants.conf w+] + + set env(PORTSRC) $dstpath/macports.conf +} diff --git a/src/macports1.0/tests/library.tcl b/src/macports1.0/tests/library.tcl index 96e5a4f6b..0203d85cb 100644 --- a/src/macports1.0/tests/library.tcl +++ b/src/macports1.0/tests/library.tcl @@ -63,27 +63,3 @@ proc macports_worker_init {} { # We don't need to handle portinterp_deferred_options, they're # automatically handled correctly. } - -# Set up a custom environment with its own configuration -proc init_tmp_prefix {srcpath dstpath} { - global env - - umask 022 - # use custom macports.conf and sources.conf - makeDirectory $dstpath - makeDirectory $dstpath/share - makeDirectory $dstpath/var/macports/registry - makeDirectory $dstpath/var/macports/distfiles - set fd [open $dstpath/macports.conf w+] - puts $fd "portdbpath $dstpath/var/macports" - puts $fd "prefix $dstpath" - puts $fd "variants_conf $dstpath/variants.conf" - puts $fd "sources_conf $srcpath/sources.conf" - puts $fd "applications_dir $dstpath/Applications" - puts $fd "frameworks_dir $dstpath/Library/Frameworks" - close $fd - file link -symbolic $dstpath/share/macports $macports::autoconf::prefix/share/macports - close [open $dstpath/variants.conf w+] - - set env(PORTSRC) $dstpath/macports.conf -} diff --git a/src/macports1.0/tests/macports.test b/src/macports1.0/tests/macports.test index 06208b439..18f9fea5a 100644 --- a/src/macports1.0/tests/macports.test +++ b/src/macports1.0/tests/macports.test @@ -15,6 +15,7 @@ package require macports 1.0 package require Thread source ./library.tcl +source ./init_tmp_prefix.tcl # clean leftovers from interrupted tests file delete -force $pwd/tmpdir diff --git a/src/macports1.0/tests/macports_dlist.test b/src/macports1.0/tests/macports_dlist.test index 6443b1f42..361c9112b 100644 --- a/src/macports1.0/tests/macports_dlist.test +++ b/src/macports1.0/tests/macports_dlist.test @@ -3,13 +3,24 @@ package require tcltest 2 namespace import tcltest::* +set pwd [file dirname [file normalize $argv0]] + source ../macports_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source ./init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + # Debug options array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options source ../macports_dlist.tcl diff --git a/src/macports1.0/tests/mport_fetch_thread.test b/src/macports1.0/tests/mport_fetch_thread.test index 789d9ad20..43d01f557 100644 --- a/src/macports1.0/tests/mport_fetch_thread.test +++ b/src/macports1.0/tests/mport_fetch_thread.test @@ -13,6 +13,7 @@ package require Thread package require Pextlib 1.0 source ./library.tcl +source ./init_tmp_prefix.tcl # clean leftovers from interrupted tests file delete -force $pwd/tmpdir diff --git a/src/macports1.0/tests/reclaim.test b/src/macports1.0/tests/reclaim.test index 2ea7403a8..d81e5745f 100644 --- a/src/macports1.0/tests/reclaim.test +++ b/src/macports1.0/tests/reclaim.test @@ -11,6 +11,7 @@ source ../macports_test_autoconf.tcl package require macports 1.0 source ./library.tcl +source ./init_tmp_prefix.tcl # clean leftovers from interrupted tests file delete -force $pwd/tmpdir diff --git a/src/package1.0/Makefile.in b/src/package1.0/Makefile.in index c349d6d08..52ba2015f 100644 --- a/src/package1.0/Makefile.in +++ b/src/package1.0/Makefile.in @@ -21,7 +21,7 @@ distclean:: clean rm -f Makefile test:: - $(TCLSH) $(srcdir)/../tests/test.tcl -nocolor + $(TEST_TCLSH) $(srcdir)/../tests/test.tcl -nocolor install:: all $(INSTALL) -d -o "${DSTUSR}" -g "${DSTGRP}" -m "${DSTMODE}" "${DESTDIR}${INSTALLDIR}" diff --git a/src/package1.0/package_test_autoconf.tcl.in b/src/package1.0/package_test_autoconf.tcl.in index 39f5e924e..fc5c01fd4 100644 --- a/src/package1.0/package_test_autoconf.tcl.in +++ b/src/package1.0/package_test_autoconf.tcl.in @@ -32,6 +32,7 @@ namespace eval macports::autoconf { variable prefix "@prefix@" + variable top_srcdir "@abs_top_srcdir@" } namespace eval portutil::autoconf { diff --git a/src/package1.0/tests/portarchivefetch.test b/src/package1.0/tests/portarchivefetch.test index 804a3d2bc..70a3396a0 100644 --- a/src/package1.0/tests/portarchivefetch.test +++ b/src/package1.0/tests/portarchivefetch.test @@ -8,12 +8,20 @@ set pwd [file dirname [file normalize $argv0]] source ../package_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options -source ./library.tcl macports_worker_init package require portarchivefetch 1.0 diff --git a/src/package1.0/tests/portdmg.test b/src/package1.0/tests/portdmg.test index 70bdf038b..629240fab 100644 --- a/src/package1.0/tests/portdmg.test +++ b/src/package1.0/tests/portdmg.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../package_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portdmg 1.0 package require portpkg 1.0 -source ./library.tcl macports_worker_init diff --git a/src/package1.0/tests/portmdmg.test b/src/package1.0/tests/portmdmg.test index 2f3a00936..e159312d8 100644 --- a/src/package1.0/tests/portmdmg.test +++ b/src/package1.0/tests/portmdmg.test @@ -8,12 +8,20 @@ set pwd [file dirname [file normalize $argv0]] source ../package_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options -source ./library.tcl macports_worker_init package require portmdmg diff --git a/src/package1.0/tests/portmpkg.test b/src/package1.0/tests/portmpkg.test index efcecaabe..442cd3046 100644 --- a/src/package1.0/tests/portmpkg.test +++ b/src/package1.0/tests/portmpkg.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../package_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portmpkg 1.0 package require portpkg 1.0 -source ./library.tcl macports_worker_init # mock getportresourcepath, tests should be able to operate without a ports tree diff --git a/src/package1.0/tests/portpkg.test b/src/package1.0/tests/portpkg.test index 49aa9595f..e2b0e0b18 100644 --- a/src/package1.0/tests/portpkg.test +++ b/src/package1.0/tests/portpkg.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../package_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portmpkg 1.0 package require portpkg 1.0 -source ./library.tcl macports_worker_init diff --git a/src/package1.0/tests/sources.conf b/src/package1.0/tests/sources.conf new file mode 100644 index 000000000..f4984b867 --- /dev/null +++ b/src/package1.0/tests/sources.conf @@ -0,0 +1,27 @@ +# MacPorts system-wide configuration file for ports tree sources. +# +# To change how MacPorts fetches base, see rsync_server and rsync_dir in +# macports.conf. +# To add a local source, add a "file://" entry. +# +# Example: file:///Users/landonf/misc/MacPorts/ports +# +# To prevent a source from synchronizing when `port sync` is used, +# append "[nosync]" at the end. +# +# Example: file:///Users/landonf/misc/MacPorts/ports [nosync] +# +# Note that MacPorts parses source URLs in order; when a port appears in +# multiple sources, it installs the first occurrence. For local sources +# to shadow remote ones, "file://" URLs must come before other URLs. +# A list of rsync mirrors is available at +# https://trac.macports.org/wiki/Mirrors#Portfiles. +# +# If an "rsync://" URL points to a .tar file, a signed .rmd160 file must +# exist in the same directory on the server and will be used to verify +# its integrity. +# +# For proper functionality of various resources (port groups, mirror +# sites, etc.), the primary MacPorts source must always be tagged +# "[default]", even if switched from the default "rsync://" URL. +rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] diff --git a/src/pextlib1.0/Makefile.in b/src/pextlib1.0/Makefile.in index b8e6c8960..42c30120a 100644 --- a/src/pextlib1.0/Makefile.in +++ b/src/pextlib1.0/Makefile.in @@ -111,14 +111,14 @@ endif .PHONY: test codesign test:: ${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/checksums.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/curl.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/filemap.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/fs-traverse.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/symlink.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/system.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/unsetenv.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/vercomp.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/checksums.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/curl.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/filemap.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/fs-traverse.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/symlink.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/system.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/unsetenv.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/vercomp.tcl ./${SHLIB_NAME} clean:: rm -f blake3/*.o blake3/*.c diff --git a/src/port1.0/Makefile.in b/src/port1.0/Makefile.in index f840d9896..3e2745214 100644 --- a/src/port1.0/Makefile.in +++ b/src/port1.0/Makefile.in @@ -41,4 +41,4 @@ install:: all $(INSTALL) -o "${DSTUSR}" -g "${DSTGRP}" -m 444 pkgIndex.tcl "${DESTDIR}${INSTALLDIR}" test:: - $(TCLSH) $(srcdir)/../tests/test.tcl -nocolor + $(TEST_TCLSH) $(srcdir)/../tests/test.tcl -nocolor diff --git a/src/port1.0/port_test_autoconf.tcl.in b/src/port1.0/port_test_autoconf.tcl.in index 87567530c..5f91fa699 100644 --- a/src/port1.0/port_test_autoconf.tcl.in +++ b/src/port1.0/port_test_autoconf.tcl.in @@ -32,4 +32,5 @@ namespace eval macports::autoconf { variable prefix "@prefix@" + variable top_srcdir "@abs_top_srcdir@" } diff --git a/src/port1.0/tests/portactivate.test b/src/port1.0/tests/portactivate.test index 9d456a07b..cce3b14dd 100644 --- a/src/port1.0/tests/portactivate.test +++ b/src/port1.0/tests/portactivate.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portactivate 1.0 package require registry 1.0 -source ./library.tcl macports_worker_init diff --git a/src/port1.0/tests/portbuild.test b/src/port1.0/tests/portbuild.test index e01861f06..2d3483d80 100644 --- a/src/port1.0/tests/portbuild.test +++ b/src/port1.0/tests/portbuild.test @@ -8,9 +8,18 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options # Provide a stub for the port callback mechanism diff --git a/src/port1.0/tests/portbump.test b/src/port1.0/tests/portbump.test index 67718e886..acadc04b4 100644 --- a/src/port1.0/tests/portbump.test +++ b/src/port1.0/tests/portbump.test @@ -8,7 +8,16 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} +set ui_options(ports_noninteractive) yes mportinit ui_options # Provide a stub for the port callback mechanism diff --git a/src/port1.0/tests/portchecksum.test b/src/port1.0/tests/portchecksum.test index 9d474d03a..a35678875 100644 --- a/src/port1.0/tests/portchecksum.test +++ b/src/port1.0/tests/portchecksum.test @@ -8,9 +8,18 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portchecksum 1.0 diff --git a/src/port1.0/tests/portclean.test b/src/port1.0/tests/portclean.test index 8bf104c0a..960f8aae2 100644 --- a/src/port1.0/tests/portclean.test +++ b/src/port1.0/tests/portclean.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portclean 1.0 source ../port_autoconf.tcl -source ./library.tcl macports_worker_init diff --git a/src/port1.0/tests/portdeactivate.test b/src/port1.0/tests/portdeactivate.test index 17d4b78a4..24f80536c 100644 --- a/src/port1.0/tests/portdeactivate.test +++ b/src/port1.0/tests/portdeactivate.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portdeactivate 1.0 package require registry 1.0 -source ./library.tcl macports_worker_init diff --git a/src/port1.0/tests/portdepends.test b/src/port1.0/tests/portdepends.test index 6d83d5184..59a01929f 100644 --- a/src/port1.0/tests/portdepends.test +++ b/src/port1.0/tests/portdepends.test @@ -8,9 +8,18 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portdepends 1.0 diff --git a/src/port1.0/tests/portdistcheck.test b/src/port1.0/tests/portdistcheck.test index 4a467869f..679e0e5ee 100644 --- a/src/port1.0/tests/portdistcheck.test +++ b/src/port1.0/tests/portdistcheck.test @@ -8,13 +8,21 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portdistcheck 1.0 -source ./library.tcl macports_worker_init diff --git a/src/port1.0/tests/portinstall.test b/src/port1.0/tests/portinstall.test index c5660bce5..c231072db 100644 --- a/src/port1.0/tests/portinstall.test +++ b/src/port1.0/tests/portinstall.test @@ -8,15 +8,23 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portinstall 1.0 source ../../registry2.0/portuninstall.tcl source ../port_autoconf.tcl -source ./library.tcl macports_worker_init diff --git a/src/port1.0/tests/portlint.test b/src/port1.0/tests/portlint.test index 4f06a9648..517e64343 100644 --- a/src/port1.0/tests/portlint.test +++ b/src/port1.0/tests/portlint.test @@ -8,9 +8,18 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portlint 1.0 diff --git a/src/port1.0/tests/portlivecheck.test b/src/port1.0/tests/portlivecheck.test index 9ac1b31eb..202fe024f 100644 --- a/src/port1.0/tests/portlivecheck.test +++ b/src/port1.0/tests/portlivecheck.test @@ -8,7 +8,16 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} +set ui_options(ports_noninteractive) yes mportinit ui_options package require portlivecheck 1.0 diff --git a/src/port1.0/tests/portload.test b/src/port1.0/tests/portload.test index c71ffba71..32485efb5 100644 --- a/src/port1.0/tests/portload.test +++ b/src/port1.0/tests/portload.test @@ -8,9 +8,18 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options set os_platform darwin diff --git a/src/port1.0/tests/portmain.test b/src/port1.0/tests/portmain.test index 1d12fae25..50a7e5334 100644 --- a/src/port1.0/tests/portmain.test +++ b/src/port1.0/tests/portmain.test @@ -8,12 +8,20 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options -source ./library.tcl macports_worker_init package require portmain 1.0 diff --git a/src/port1.0/tests/portpatch.test b/src/port1.0/tests/portpatch.test index 6244b0b05..e27f549ad 100644 --- a/src/port1.0/tests/portpatch.test +++ b/src/port1.0/tests/portpatch.test @@ -8,14 +8,22 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portpatch source ../port_autoconf.tcl -source ./library.tcl macports_worker_init diff --git a/src/port1.0/tests/portstartupitem.test b/src/port1.0/tests/portstartupitem.test index 440be91c0..f1e3c0a88 100644 --- a/src/port1.0/tests/portstartupitem.test +++ b/src/port1.0/tests/portstartupitem.test @@ -9,12 +9,20 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options -source ./library.tcl macports_worker_init package require port 1.0 diff --git a/src/port1.0/tests/porttest.test b/src/port1.0/tests/porttest.test index 841111a6a..2c42d61e1 100644 --- a/src/port1.0/tests/porttest.test +++ b/src/port1.0/tests/porttest.test @@ -8,12 +8,20 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options -source ./library.tcl macports_worker_init package require port 1.0 package require registry 1.0 diff --git a/src/port1.0/tests/portuninstall.test b/src/port1.0/tests/portuninstall.test index c6b681dd6..640f69a3a 100644 --- a/src/port1.0/tests/portuninstall.test +++ b/src/port1.0/tests/portuninstall.test @@ -8,15 +8,23 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options package require portinstall 1.0 source ../../registry2.0/portuninstall.tcl source ../port_autoconf.tcl -source ./library.tcl macports_worker_init set subport gcc_select diff --git a/src/port1.0/tests/portutil.test b/src/port1.0/tests/portutil.test index 6305596fc..2814f2538 100644 --- a/src/port1.0/tests/portutil.test +++ b/src/port1.0/tests/portutil.test @@ -9,12 +9,20 @@ set pwd [file dirname [file normalize $argv0]] source ../port_test_autoconf.tcl package require macports 1.0 +source ./library.tcl +source $macports::autoconf::top_srcdir/src/macports1.0/tests/init_tmp_prefix.tcl + +# clean leftovers from interrupted tests +file delete -force $pwd/tmpdir +# use a local, temporary prefix for testing +init_tmp_prefix $pwd $pwd/tmpdir + array set ui_options {} #set ui_options(ports_debug) yes #set ui_options(ports_verbose) yes +set ui_options(ports_noninteractive) yes mportinit ui_options -source ./library.tcl macports_worker_init package require registry 1.0 diff --git a/src/port1.0/tests/sources.conf b/src/port1.0/tests/sources.conf new file mode 100644 index 000000000..f4984b867 --- /dev/null +++ b/src/port1.0/tests/sources.conf @@ -0,0 +1,27 @@ +# MacPorts system-wide configuration file for ports tree sources. +# +# To change how MacPorts fetches base, see rsync_server and rsync_dir in +# macports.conf. +# To add a local source, add a "file://" entry. +# +# Example: file:///Users/landonf/misc/MacPorts/ports +# +# To prevent a source from synchronizing when `port sync` is used, +# append "[nosync]" at the end. +# +# Example: file:///Users/landonf/misc/MacPorts/ports [nosync] +# +# Note that MacPorts parses source URLs in order; when a port appears in +# multiple sources, it installs the first occurrence. For local sources +# to shadow remote ones, "file://" URLs must come before other URLs. +# A list of rsync mirrors is available at +# https://trac.macports.org/wiki/Mirrors#Portfiles. +# +# If an "rsync://" URL points to a .tar file, a signed .rmd160 file must +# exist in the same directory on the server and will be used to verify +# its integrity. +# +# For proper functionality of various resources (port groups, mirror +# sites, etc.), the primary MacPorts source must always be tagged +# "[default]", even if switched from the default "rsync://" URL. +rsync://rsync.macports.org/macports/release/tarballs/ports.tar [default] diff --git a/src/registry2.0/Makefile.in b/src/registry2.0/Makefile.in index e0165506b..ed8300e2b 100644 --- a/src/registry2.0/Makefile.in +++ b/src/registry2.0/Makefile.in @@ -32,8 +32,8 @@ ${SHLIB_NAME}: ../cregistry/cregistry.a .PHONY: test codesign test:: ${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/entry.tcl ./${SHLIB_NAME} - ${TCLSH} $(srcdir)/tests/depends.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/entry.tcl ./${SHLIB_NAME} + ${TEST_TCLSH} $(srcdir)/tests/depends.tcl ./${SHLIB_NAME} distclean:: clean rm -f registry_autoconf.tcl diff --git a/src/tests/test.tcl b/src/tests/test.tcl index 36c3d19ad..392f25971 100644 --- a/src/tests/test.tcl +++ b/src/tests/test.tcl @@ -5,11 +5,11 @@ set color_out "" set tcl "" set err "" -# Get tclsh path. +# Get test tclsh path. set autoconf ../../Mk/macports.autoconf.mk set fp [open $autoconf r] while {[gets $fp line] != -1} { - if {[string match "TCLSH*" $line] != 0} { + if {[string match "TEST_TCLSH*" $line] != 0} { set tcl [lrange [split $line " "] 1 1] } } diff --git a/tests/Makefile.in b/tests/Makefile.in index f7e82abae..163e18e17 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -10,12 +10,13 @@ install:: # Run all regression tests # tclsh test.tcl -h for more options. test:: - $(TCLSH) $(srcdir)/test.tcl -nocolor + $(TEST_TCLSH) $(srcdir)/test.tcl -nocolor clean:: distclean:: clean rm -f Makefile rm -f test.tcl + rm -f test-tclsh rm -f test/library.tcl rm -f test/trace/test.tcl diff --git a/tests/test-macports.conf b/tests/test-macports.conf index 8e6c94e1f..ed1277a79 100644 --- a/tests/test-macports.conf +++ b/tests/test-macports.conf @@ -13,7 +13,7 @@ sources_conf /tmp/macports-tests/opt/local/etc/macports/sources.conf # to the list of variables that are not removed from the environment used # while processing ports # extra_env KEEP_THIS THIS_TOO -extra_env ENVA ENVB +extra_env ENVA ENVB TCLLIBPATH # Disable ccache for tests configureccache no diff --git a/tests/test-tclsh.in b/tests/test-tclsh.in new file mode 100644 index 000000000..53e940007 --- /dev/null +++ b/tests/test-tclsh.in @@ -0,0 +1,21 @@ +#!/bin/sh + +DESTROOT="@abs_top_builddir@/vendor/vendor-destroot" +MP_PREFIX="@prefix@/libexec/macports" +LIB_PATH="${DESTROOT}${MP_PREFIX}/lib:${DESTROOT}${MP_PREFIX}/lib/@SQLITE3_LIBNAME@" + +# For Linux and *BSD +if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="$LIB_PATH" +else + export LD_LIBRARY_PATH="$LIB_PATH:$LD_LIBRARY_PATH" +fi +# DYLD_LIBRARY_PATH tends to get lost on recent macOS due to basic +# tools like /bin/sh being subject to SIP, so we have to edit the load +# commands instead (see vendor/Makefile.in). + +# Tcl package search path: vendor libs first, then in-tree src packages +SRCDIR="@abs_top_builddir@/src" +export TCLLIBPATH="${DESTROOT}${MP_PREFIX}/lib ${SRCDIR}/macports1.0 ${SRCDIR}/port1.0 ${SRCDIR}/pextlib1.0 ${SRCDIR}/registry2.0 ${SRCDIR}/machista1.0 ${SRCDIR}/mpcommon1.0 ${SRCDIR}/package1.0 ${SRCDIR}/portlist1.0 ${SRCDIR}/darwintracelib1.0" + +exec "${DESTROOT}@TCLSH@" "$@" diff --git a/tests/test.tcl.in b/tests/test.tcl.in index fd67659c1..ff7873fd0 100644 --- a/tests/test.tcl.in +++ b/tests/test.tcl.in @@ -28,7 +28,7 @@ set color_out "" set err "" # Get tclsh path. -set tcl "@TCLSH@" +set tcl "@TEST_TCLSH@" proc print_help {arg} { if { $arg eq "tests" } { diff --git a/tests/test/envvariables/test.tcl b/tests/test/envvariables/test.tcl index 84d918a9e..b179a485d 100644 --- a/tests/test/envvariables/test.tcl +++ b/tests/test/envvariables/test.tcl @@ -15,14 +15,9 @@ port_index port_clean $path proc envvar_test {} { - global output_file path portsrc bindir + global output_file path portsrc test_tclsh top_srcdir - # Build helping string - set string "export ENVA=A; export ENVB=B; " - append string "export PORTSRC=${portsrc}; " - append string "${bindir}/port test" - - exec -ignorestderr sh -c $string > output + exec -ignorestderr env ENVA=A ENVB=B PORTSRC=${portsrc} ${test_tclsh} ${top_srcdir}/src/port/port.tcl test > output set line [get_line $path/$output_file "a"] set line2 [get_line $path/$output_file "b"] return $line$line2 diff --git a/tests/test/library.tcl.in b/tests/test/library.tcl.in index 83a1a6f0a..51c118818 100644 --- a/tests/test/library.tcl.in +++ b/tests/test/library.tcl.in @@ -9,18 +9,19 @@ set work_dir "work" # constraint indicating whether the platform supports trace mode ::tcltest::testConstraint tracemode_support [expr {@TRACEMODE_SUPPORT@ != 0}] +# In-tree test interpreter and source paths +set test_tclsh "@TEST_TCLSH@" +set top_srcdir "@abs_top_srcdir@" + # Set of procs used for testing. -# Sets $bindir variable from autoconf +# Sets variables from autoconf for in-tree testing proc load_variables {pwd} { - global bindir datadir portsrc cpwd + global datadir portsrc cpwd test_tclsh top_srcdir set cpwd [file dirname [file dirname $pwd]] - set prefix "@prefix@" - set exec_prefix "@exec_prefix@" - set bindir "@bindir@" - set datadir "@datarootdir@" + set datadir "@prefix@/share" set portsrc ${cpwd}/test-macports.conf } @@ -79,7 +80,7 @@ proc with_portsrc {portsrc script} { # Sets initial directories proc set_dir {} { - global datadir cpwd + global datadir cpwd top_srcdir cleanup @@ -90,13 +91,21 @@ proc set_dir {} { /tmp/macports-tests/opt/local/var/macports/registry \ /tmp/macports-tests/opt/local/var/macports/build - file link -symbolic /tmp/macports-tests/opt/local/share/macports $datadir/macports + # Populate share/macports from the source tree instead of the prefix + file mkdir /tmp/macports-tests/opt/local/share/macports/install + file copy $top_srcdir/macports-pubkey.pem /tmp/macports-tests/opt/local/share/macports/ + file copy $top_srcdir/setupenv.bash /tmp/macports-tests/opt/local/share/macports/ + file copy $top_srcdir/doc/base.mtree /tmp/macports-tests/opt/local/share/macports/install/ + file copy $top_srcdir/doc/prefix.mtree /tmp/macports-tests/opt/local/share/macports/install/ + file copy $top_srcdir/doc/macosx.mtree /tmp/macports-tests/opt/local/share/macports/install/ + file copy $top_srcdir/keys /tmp/macports-tests/opt/local/share/macports/ + file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/ file link -symbolic /tmp/macports-tests/ports/test $cpwd/test } # Run portindex proc port_index {} { - global bindir cpwd + global cpwd portsrc test_tclsh top_srcdir # Move up 2 level to run portindex. set path [pwd] @@ -107,10 +116,11 @@ proc port_index {} { } without_darwintrace_env { - exec -ignorestderr ${bindir}/portindex 2>@1 + with_portsrc $portsrc { + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/portindex.tcl 2>@1 + } } - file copy ${cpwd}/sources.conf /tmp/macports-tests/opt/local/etc/macports/ file copy ${cpwd}/PortIndex ${cpwd}/PortIndex.quick /tmp/macports-tests/ports/ cd $path @@ -118,7 +128,7 @@ proc port_index {} { # Executes port clean. proc port_clean {pwd} { - global bindir portsrc + global portsrc test_tclsh top_srcdir set back [pwd] cd $pwd @@ -126,7 +136,7 @@ proc port_clean {pwd} { catch { without_darwintrace_env { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port clean 2>@1 + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl clean 2>@1 } } } @@ -135,7 +145,7 @@ proc port_clean {pwd} { # Runs the portfile. proc port_run {pwd} { - global bindir portsrc + global portsrc test_tclsh top_srcdir set back [pwd] cd $pwd @@ -143,7 +153,7 @@ proc port_run {pwd} { set result [catch { without_darwintrace_env { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port -d -N test >&output + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl -d -N test >&output } } }] @@ -153,14 +163,14 @@ proc port_run {pwd} { # Runs port trace. proc port_trace {pwd} { - global bindir portsrc + global portsrc test_tclsh top_srcdir set back [pwd] cd $pwd set result [catch { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port -d -N -t test >&output 2>@1 + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl -d -N -t test >&output 2>@1 } }] cd $back @@ -169,12 +179,12 @@ proc port_trace {pwd} { # Installs new portfile. proc port_install {{name "current"}} { - global bindir portsrc + global portsrc test_tclsh top_srcdir set result [catch { without_darwintrace_env { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port install $name > output 2>@1 + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl install $name > output 2>@1 } } }] @@ -183,12 +193,12 @@ proc port_install {{name "current"}} { # Run configure command. proc port_config {pwd} { - global bindir portsrc + global portsrc test_tclsh top_srcdir set result [catch { without_darwintrace_env { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port configure 2>@1 + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl configure 2>@1 } } }] @@ -197,7 +207,7 @@ proc port_config {pwd} { # Run destroot command. proc port_destroot {pwd} { - global path bindir portsrc work_dir output_file + global path portsrc work_dir output_file test_tclsh top_srcdir file copy -force ${path}/statefile ${work_dir}/.macports.statefile-unknown-version.state if { [exec -ignorestderr id -u] == 0 } { @@ -206,7 +216,7 @@ proc port_destroot {pwd} { set result [catch { without_darwintrace_env { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port destroot >$output_file 2>@1 + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl destroot >$output_file 2>@1 } } }] @@ -215,12 +225,12 @@ proc port_destroot {pwd} { # Uninstalls portfile. proc port_uninstall {{name "current"}} { - global bindir portsrc + global portsrc test_tclsh top_srcdir set result [catch { without_darwintrace_env { with_portsrc $portsrc { - exec -ignorestderr ${bindir}/port uninstall $name > output 2>@1 + exec -ignorestderr ${test_tclsh} ${top_srcdir}/src/port/port.tcl uninstall $name > output 2>@1 } } }] diff --git a/tests/test/universal/test.tcl b/tests/test/universal/test.tcl index 3f3e13f67..e2af8f0e6 100644 --- a/tests/test/universal/test.tcl +++ b/tests/test/universal/test.tcl @@ -15,7 +15,7 @@ set_dir port_index proc univ_test {opt} { - global output_file path portsrc bindir + global output_file path portsrc test_tclsh top_srcdir # Modify Porfile.in for variants. if {$opt ne "yes"} { @@ -27,10 +27,7 @@ proc univ_test {opt} { } port_clean $path - # Build helping string - set string "export PORTSRC=${portsrc} ; ${bindir}/port info --variants" - - exec -ignorestderr sh -c $string > output 2>@1 + exec -ignorestderr env PORTSRC=${portsrc} ${test_tclsh} ${top_srcdir}/src/port/port.tcl info --variants > output 2>@1 set var "variants:*" set line [get_line $path/$output_file $var] return $line