[108655] branches/gsoc13-tests/src/port1.0/tests/portload.test

marius at macports.org marius at macports.org
Mon Jul 29 12:00:55 PDT 2013


Revision: 108655
          https://trac.macports.org/changeset/108655
Author:   marius at macports.org
Date:     2013-07-29 12:00:55 -0700 (Mon, 29 Jul 2013)
Log Message:
-----------
portload.test: added partial test case

Added Paths:
-----------
    branches/gsoc13-tests/src/port1.0/tests/portload.test

Added: branches/gsoc13-tests/src/port1.0/tests/portload.test
===================================================================
--- branches/gsoc13-tests/src/port1.0/tests/portload.test	                        (rev 0)
+++ branches/gsoc13-tests/src/port1.0/tests/portload.test	2013-07-29 19:00:55 UTC (rev 108655)
@@ -0,0 +1,53 @@
+package require tcltest 2
+namespace import tcltest::*
+
+set pwd [file normalize $argv0]
+set pwd [eval file join {*}[lrange [file split $pwd] 0 end-1]]
+
+package require macports 1.0
+mportinit
+
+source ../portload.tcl
+source ../port_autoconf.tcl
+
+
+test load_main {
+    Load main unit test.
+} -setup {
+    if {[getuid] != 0} {return "FAIL: not root, skipping test"}
+
+    set path /Library/test/files
+    file mkdir $path
+
+    # Create dummy plist
+    set fd [open $path/file.plist w+]
+    puts $fd "\<?xml version=\"1.0\" encoding=\"UTF-8\"?\>"
+    puts $fd "\<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\>"
+    puts $fd "\<plist version=\"1.0\"\>"
+    puts $fd "\<dict\>"
+    puts $fd "\<key\>Label\</key\>"
+    puts $fd "\<string\>org.test.load\</string\>"
+    puts $fd "\<key\>ProgramArguments\</key\>"
+    puts $fd "\<array\>\<string\>/bin/ls\</string\>\</array\>"
+    puts $fd "\</dict\>"
+    puts $fd "\</plist\>"
+    close $fd
+
+} -body {
+    set launchctl_path ${portutil::autoconf::launchctl_path}
+    set startupitem.location test
+    set startupitem.plist files/file.plist
+
+    if {[portload::load_main] != 0} {
+	return "FAIL: unable to load plist"
+    }
+    return "Load successful."
+
+} -cleanup {
+    exec $launchctl_path unload -w $path 2>@stderr
+    file delete -force /Library/test
+
+} -result "Load successful."
+
+
+cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130729/8f2aebb3/attachment.html>


More information about the macports-changes mailing list