[107723] branches/gsoc13-tests/tests/test/universal

marius at macports.org marius at macports.org
Thu Jul 4 10:05:50 PDT 2013


Revision: 107723
          https://trac.macports.org/changeset/107723
Author:   marius at macports.org
Date:     2013-07-04 10:05:50 -0700 (Thu, 04 Jul 2013)
Log Message:
-----------
Added universal test (includes universal-2 test).

Added Paths:
-----------
    branches/gsoc13-tests/tests/test/universal/DESCRIPTION
    branches/gsoc13-tests/tests/test/universal/Portfile.in
    branches/gsoc13-tests/tests/test/universal/test.tcl

Removed Paths:
-------------
    branches/gsoc13-tests/tests/test/universal/Makefile
    branches/gsoc13-tests/tests/test/universal/Portfile
    branches/gsoc13-tests/tests/test/universal/master

Added: branches/gsoc13-tests/tests/test/universal/DESCRIPTION
===================================================================
--- branches/gsoc13-tests/tests/test/universal/DESCRIPTION	                        (rev 0)
+++ branches/gsoc13-tests/tests/test/universal/DESCRIPTION	2013-07-04 17:05:50 UTC (rev 107723)
@@ -0,0 +1,7 @@
+This test checks the handling of the universal variant in MacPorts base.
+Every port should have an universal variant unless 'universal_variant no' is
+specified.
+
+There are 2 test cases. One for universal variant set and another for no
+universal variant. For each test a specific Portfile is generated from the
+Port.in file.

Deleted: branches/gsoc13-tests/tests/test/universal/Makefile
===================================================================
--- branches/gsoc13-tests/tests/test/universal/Makefile	2013-07-04 16:59:52 UTC (rev 107722)
+++ branches/gsoc13-tests/tests/test/universal/Makefile	2013-07-04 17:05:50 UTC (rev 107723)
@@ -1,17 +0,0 @@
-include ../../../Mk/macports.autoconf.mk
-
-.PHONY: test
-
-$(bindir)/port:
-	@echo "Please install MacPorts before running this test"
-	@exit 1
-
-test:
-	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
-	@sh -c "export PORTSRC=$(PORTSRC); $(bindir)/port info --variants" > output 2>&1 || (cat output; exit 1)
-	@diff -u master output 2>&1 | tee difference
-	@if [ -s difference ]; then \
-		exit 1; \
-	else \
-		rm -f difference; \
-	fi

Deleted: branches/gsoc13-tests/tests/test/universal/Portfile
===================================================================
--- branches/gsoc13-tests/tests/test/universal/Portfile	2013-07-04 16:59:52 UTC (rev 107722)
+++ branches/gsoc13-tests/tests/test/universal/Portfile	2013-07-04 17:05:50 UTC (rev 107723)
@@ -1,23 +0,0 @@
-# $Id$
-
-PortSystem 1.0
-name		universal
-version		1
-categories	test
-maintainers	pguyot at kallisys.net
-description	Test port for universal variant
-homepage	http://www.macports.org/
-platforms	darwin
-
-long_description ${description}
-
-distfiles
-configure	{}
-build		{}
-destroot	{
-	system "touch ${destroot}${prefix}/lib/${name}"
-}
-
-test		{}
-
-default_variants +universal

Added: branches/gsoc13-tests/tests/test/universal/Portfile.in
===================================================================
--- branches/gsoc13-tests/tests/test/universal/Portfile.in	                        (rev 0)
+++ branches/gsoc13-tests/tests/test/universal/Portfile.in	2013-07-04 17:05:50 UTC (rev 107723)
@@ -0,0 +1,18 @@
+# $Id$
+PortSystem 1.0
+name            universal
+version         1
+categories      test
+maintainers     pguyot at kallisys.net
+description     Test port for universal variant
+homepage        http://www.macports.org/
+platforms       darwin
+long_description ${description}
+distfiles
+configure       {}
+build           {}
+destroot        {
+        system "touch ${destroot}${prefix}/lib/${name}"
+}
+test            {}
+ at option@

Deleted: branches/gsoc13-tests/tests/test/universal/master
===================================================================
--- branches/gsoc13-tests/tests/test/universal/master	2013-07-04 16:59:52 UTC (rev 107722)
+++ branches/gsoc13-tests/tests/test/universal/master	2013-07-04 17:05:50 UTC (rev 107723)
@@ -1 +0,0 @@
-variants: universal

Added: branches/gsoc13-tests/tests/test/universal/test.tcl
===================================================================
--- branches/gsoc13-tests/tests/test/universal/test.tcl	                        (rev 0)
+++ branches/gsoc13-tests/tests/test/universal/test.tcl	2013-07-04 17:05:50 UTC (rev 107723)
@@ -0,0 +1,57 @@
+package require tcltest 2
+namespace import tcltest::*
+
+source [file dirname $argv0]/../library.tcl
+
+makeFile "" "Portfile"
+makeFile "" $output_file
+makeDirectory $work_dir
+set path [file dirname [file normalize $argv0]]
+
+# Initial setup
+load_variables $path
+set_dir
+port_index
+
+proc univ_test {opt} {
+    global output_file
+    global path
+    global portsrc
+    global bindir
+
+    # Modify Porfile.in for variants.
+    if {[string compare $opt "yes"]} {
+        # No universal variant
+        exec sed "s/@option@/universal_variant\ no/" $path/Portfile.in > Portfile
+    } else {
+        # Add universal variant
+        exec sed "s/@option@/default_variants\ +universal/" $path/Portfile.in > Portfile
+    }
+    port_clean $path
+
+    # Build helping string
+    append string "export PORTSRC=" $portsrc "; "
+    append string $bindir "port info --variants"
+
+    exec sh -c $string > output 2>@1
+    set var "variants:*"
+    set line [get_line $path/$output_file $var]
+    return $line
+}
+
+
+test universal {
+    Regression test for universal variant.
+} -body {
+    univ_test "yes"
+} -result "variants: universal"
+
+test nouniversal {
+    Regression test for no universal variant.
+} -body {
+    univ_test "no"
+} -result "variants: "
+
+
+cleanup
+cleanupTests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130704/bb0ecb7e/attachment.html>


More information about the macports-changes mailing list