You've already forked macports-base
mirror of
https://github.com/macports/macports-base.git
synced 2026-07-12 18:18:43 -07:00
tests: Fix trace test to run in source (and skip if root)
This also means we no longer need to reinplace the macports user's username into the test file, so there's no longer a need to generate it using configure.
This commit is contained in:
committed by
Clemens Lang
parent
2076649ac7
commit
dc9b17c26a
@@ -42,7 +42,6 @@ src/**/*.dSYM
|
|||||||
tests/test.tcl
|
tests/test.tcl
|
||||||
tests/test-tclsh
|
tests/test-tclsh
|
||||||
tests/test/library.tcl
|
tests/test/library.tcl
|
||||||
tests/test/trace/test.tcl
|
|
||||||
|
|
||||||
vendor/vendor-destroot/
|
vendor/vendor-destroot/
|
||||||
vendor/tclsh
|
vendor/tclsh
|
||||||
|
|||||||
@@ -10241,7 +10241,7 @@ printf '%s\n' "yes" >&6; }
|
|||||||
|
|
||||||
|
|
||||||
# Output
|
# Output
|
||||||
ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/dmg/postflight setupenv.bash src/Makefile src/compat/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/darwintracelib1.0/tests/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/mpcommon1.0/Makefile src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port/port-tclsh.c src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/portlist1.0/Makefile src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl tests/test/library.tcl tests/test/trace/test.tcl vendor/Makefile vendor/critcl/lib/critcl/Config vendor/signify-osx/autoconf.mk"
|
ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/Makefile doc/base.mtree doc/macosx.mtree doc/macports.conf doc/prefix.mtree doc/pubkeys.conf portmgr/dmg/postflight setupenv.bash src/Makefile src/compat/Makefile src/cregistry/Makefile src/darwintracelib1.0/Makefile src/darwintracelib1.0/tests/Makefile src/machista1.0/Makefile src/macports1.0/Makefile src/macports1.0/macports_autoconf.tcl src/macports1.0/macports_test_autoconf.tcl src/mpcommon1.0/Makefile src/package1.0/Makefile src/package1.0/package_test_autoconf.tcl src/pextlib1.0/Makefile src/port/Makefile src/port/port-tclsh.c src/port1.0/Makefile src/port1.0/port_autoconf.tcl src/port1.0/port_test_autoconf.tcl src/portlist1.0/Makefile src/programs/Makefile src/registry2.0/Makefile src/registry2.0/registry_autoconf.tcl tests/Makefile tests/test.tcl tests/test/library.tcl vendor/Makefile vendor/critcl/lib/critcl/Config vendor/signify-osx/autoconf.mk"
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files vendor/tclsh"
|
ac_config_files="$ac_config_files vendor/tclsh"
|
||||||
@@ -10939,7 +10939,6 @@ do
|
|||||||
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
|
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
|
||||||
"tests/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test.tcl" ;;
|
"tests/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test.tcl" ;;
|
||||||
"tests/test/library.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/library.tcl" ;;
|
"tests/test/library.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/library.tcl" ;;
|
||||||
"tests/test/trace/test.tcl") CONFIG_FILES="$CONFIG_FILES tests/test/trace/test.tcl" ;;
|
|
||||||
"vendor/Makefile") CONFIG_FILES="$CONFIG_FILES vendor/Makefile" ;;
|
"vendor/Makefile") CONFIG_FILES="$CONFIG_FILES vendor/Makefile" ;;
|
||||||
"vendor/critcl/lib/critcl/Config") CONFIG_FILES="$CONFIG_FILES vendor/critcl/lib/critcl/Config" ;;
|
"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/signify-osx/autoconf.mk") CONFIG_FILES="$CONFIG_FILES vendor/signify-osx/autoconf.mk" ;;
|
||||||
|
|||||||
@@ -613,7 +613,6 @@ AC_CONFIG_FILES([
|
|||||||
tests/Makefile
|
tests/Makefile
|
||||||
tests/test.tcl
|
tests/test.tcl
|
||||||
tests/test/library.tcl
|
tests/test/library.tcl
|
||||||
tests/test/trace/test.tcl
|
|
||||||
vendor/Makefile
|
vendor/Makefile
|
||||||
vendor/critcl/lib/critcl/Config
|
vendor/critcl/lib/critcl/Config
|
||||||
vendor/signify-osx/autoconf.mk
|
vendor/signify-osx/autoconf.mk
|
||||||
|
|||||||
@@ -19,4 +19,3 @@ distclean:: clean
|
|||||||
rm -f test.tcl
|
rm -f test.tcl
|
||||||
rm -f test-tclsh
|
rm -f test-tclsh
|
||||||
rm -f test/library.tcl
|
rm -f test/library.tcl
|
||||||
rm -f test/trace/test.tcl
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
include ../../../Mk/macports.autoconf.mk
|
|
||||||
|
|
||||||
.PHONY: test
|
|
||||||
|
|
||||||
PWD=$(shell dirname `pwd`)
|
|
||||||
|
|
||||||
$(bindir)/port:
|
|
||||||
@echo "Please install MacPorts before running this test"
|
|
||||||
@exit 1
|
|
||||||
|
|
||||||
test:
|
|
||||||
@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
|
|
||||||
@mkdir -p ../tracetesttmp
|
|
||||||
@-[ "`id -u`" == "0" ] && chown $(RUNUSR) ../tracetesttmp
|
|
||||||
@([ "`id -u`" == "0" ] && sudo -u $(RUNUSR) touch ../tracetesttmp/delete-trace) || touch ../tracetesttmp/delete-trace
|
|
||||||
@([ "`id -u`" == "0" ] && sudo -u $(RUNUSR) touch ../tracetesttmp/rename-trace) || touch ../tracetesttmp/rename-trace
|
|
||||||
@([ "`id -u`" == "0" ] && sudo -u $(RUNUSR) mkdir -p ../tracetesttmp/rmdir-trace) || mkdir -p ../tracetesttmp/rmdir-trace
|
|
||||||
@rm -f /tmp/hello-trace
|
|
||||||
@ln -sf /usr/share/man/man1/awk.1 /tmp/link-trace2
|
|
||||||
@-[ "`id -u`" == "0" ] && chown -h $(RUNUSR) /tmp/link-trace2
|
|
||||||
@PORTSRC=$(PORTSRC) $(TEST_TCLSH) $(top_srcdir)/port/port.tcl -vt test > output 2>&1 || (cat output; exit 1)
|
|
||||||
@rm -f /tmp/link-trace2
|
|
||||||
@rm -f /tmp/hello-trace
|
|
||||||
@rm -rf ../tracetesttmp
|
|
||||||
@diff -u master output 2>&1 | tee difference
|
|
||||||
@if [ -s difference ]; then \
|
|
||||||
exit 1; \
|
|
||||||
else \
|
|
||||||
rm -f difference output; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
clean::
|
|
||||||
@PORTSRC=$(PORTSRC) $(bindir)/port clean >/dev/null
|
|
||||||
@rm -f output output.sed difference
|
|
||||||
@rm -rf ../tracetesttmp
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package require tcltest 2
|
package require tcltest 2
|
||||||
|
namespace import tcltest::*
|
||||||
|
|
||||||
# need pextlib to drop privs
|
# need pextlib to drop privs
|
||||||
package require Pextlib 1.0
|
package require Pextlib 1.0
|
||||||
|
|
||||||
namespace import tcltest::*
|
|
||||||
|
|
||||||
source [file dirname $argv0]/../library.tcl
|
source [file dirname $argv0]/../library.tcl
|
||||||
|
|
||||||
makeFile "" $output_file
|
makeFile "" $output_file
|
||||||
@@ -12,14 +11,12 @@ makeDirectory $work_dir
|
|||||||
set path [file dirname [file normalize $argv0]]
|
set path [file dirname [file normalize $argv0]]
|
||||||
|
|
||||||
load_variables $path
|
load_variables $path
|
||||||
|
set_dir
|
||||||
|
port_index
|
||||||
|
|
||||||
proc test_trace {} {
|
proc test_trace {} {
|
||||||
global path output_file
|
global path output_file
|
||||||
|
|
||||||
set user "@RUNUSR@"
|
|
||||||
|
|
||||||
set_dir
|
|
||||||
port_index
|
|
||||||
port_clean $path
|
port_clean $path
|
||||||
|
|
||||||
file delete -force /tmp/hello-trace
|
file delete -force /tmp/hello-trace
|
||||||
@@ -27,26 +24,12 @@ proc test_trace {} {
|
|||||||
file link -symbolic /tmp/link-trace2 /usr/share/man/man1/awk.1
|
file link -symbolic /tmp/link-trace2 /usr/share/man/man1/awk.1
|
||||||
|
|
||||||
makeDirectory ../tracetesttmp
|
makeDirectory ../tracetesttmp
|
||||||
if {[getuid] == 0} {
|
|
||||||
file attributes ../tracetesttmp -owner $user
|
|
||||||
exec -ignorestderr chown -h $user /tmp/link-trace2
|
|
||||||
}
|
|
||||||
|
|
||||||
if {[getuid] == 0} {
|
|
||||||
seteuid [name_to_uid $user]
|
|
||||||
}
|
|
||||||
exec -ignorestderr touch ../tracetesttmp/delete-trace
|
exec -ignorestderr touch ../tracetesttmp/delete-trace
|
||||||
exec -ignorestderr touch ../tracetesttmp/rename-trace
|
exec -ignorestderr touch ../tracetesttmp/rename-trace
|
||||||
exec -ignorestderr mkdir ../tracetesttmp/rmdir-trace
|
exec -ignorestderr file mkdir ../tracetesttmp/rmdir-trace
|
||||||
if {[getuid] == 0} {
|
|
||||||
seteuid 0
|
|
||||||
}
|
|
||||||
|
|
||||||
port_trace $path
|
port_trace $path
|
||||||
|
|
||||||
file delete -force /tmp/link-trace2
|
|
||||||
file delete -force /tmp/hello-trace
|
|
||||||
|
|
||||||
set err "error*"
|
set err "error*"
|
||||||
set line [get_line $path/$output_file $err]
|
set line [get_line $path/$output_file $err]
|
||||||
set unsupported [get_line $path/$output_file "*tracelib not supported on this platform*"]
|
set unsupported [get_line $path/$output_file "*tracelib not supported on this platform*"]
|
||||||
@@ -57,14 +40,18 @@ proc test_trace {} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set trace_constraints [list tracemode_support]
|
testConstraint notRoot [expr {[getuid] != 0}]
|
||||||
|
|
||||||
test trace {
|
test trace {Regression test for trace.} \
|
||||||
Regression test for trace.
|
-constraints [list tracemode_support notRoot] \
|
||||||
} -constraints $trace_constraints \
|
-body {
|
||||||
-body {
|
test_trace
|
||||||
test_trace
|
} \
|
||||||
} -result "No errors found."
|
-cleanup {
|
||||||
|
file delete -force /tmp/link-trace2
|
||||||
|
file delete -force /tmp/hello-trace
|
||||||
|
} \
|
||||||
|
-result "No errors found."
|
||||||
|
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
Reference in New Issue
Block a user