diff options
author | dirkbaechle <devnull@localhost> | 2012-09-06 23:16:49 (GMT) |
---|---|---|
committer | dirkbaechle <devnull@localhost> | 2012-09-06 23:16:49 (GMT) |
commit | 299a549ae875c18748f395aca51068e27ac0d489 (patch) | |
tree | 3d3613396456a717288d7b5e20f38eb5833c5698 /test/packaging | |
parent | 1c8744b6d4ec8812746415d1aae4f13e634809ca (diff) | |
download | SCons-299a549ae875c18748f395aca51068e27ac0d489.zip SCons-299a549ae875c18748f395aca51068e27ac0d489.tar.gz SCons-299a549ae875c18748f395aca51068e27ac0d489.tar.bz2 |
- added two new functions must_exist_one_of/must_not_exist_any_of to TestCmd,
supporting wildcards
- rewrote several test/packaging tests, using the new matching functions instead
of relying on the os.uname() machine value for determining the resulting RPM filename
- renamed glob modules in test/scons-time to avoid name clashes
- minor fix: added Java 1.7 as supported version to Tool/JavaCommon.py
Diffstat (limited to 'test/packaging')
-rw-r--r-- | test/packaging/option--package-type.py | 15 | ||||
-rw-r--r-- | test/packaging/rpm/cleanup.py | 13 | ||||
-rw-r--r-- | test/packaging/rpm/internationalization.py | 24 | ||||
-rw-r--r-- | test/packaging/rpm/multipackage.py | 19 | ||||
-rw-r--r-- | test/packaging/rpm/package.py | 15 | ||||
-rw-r--r-- | test/packaging/rpm/tagging.py | 15 |
6 files changed, 28 insertions, 73 deletions
diff --git a/test/packaging/option--package-type.py b/test/packaging/option--package-type.py index 9bfa565..2a898ff 100644 --- a/test/packaging/option--package-type.py +++ b/test/packaging/option--package-type.py @@ -30,15 +30,6 @@ Test the --package-type option. import TestSCons -machine = TestSCons.machine -try: - # Try to get the actual machine type (like i586), since - # TestSCons maps all ix86 types to a i386 machine internally. - import os - machine = os.uname()[4] -except AttributeError: - pass - _python_ = TestSCons._python_ test = TestSCons.TestSCons() @@ -76,12 +67,12 @@ env.Package( NAME = 'foo', """ % locals()) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine +machine_rpm = 'foo-1.2.3-0.*.rpm' test.run(arguments='package PACKAGETYPE=rpm', stderr = None) test.must_exist( src_rpm ) -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.must_not_exist( 'bin/main.c' ) test.must_not_exist( '/bin/main.c' ) @@ -89,7 +80,7 @@ test.run(arguments='-c package PACKAGETYPE=rpm', stderr = None) test.run(arguments='package --package-type=rpm', stderr = None) test.must_exist( src_rpm ) -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.must_not_exist( 'bin/main.c' ) test.must_not_exist( '/bin/main.c' ) diff --git a/test/packaging/rpm/cleanup.py b/test/packaging/rpm/cleanup.py index 9d79219..91feba1 100644 --- a/test/packaging/rpm/cleanup.py +++ b/test/packaging/rpm/cleanup.py @@ -30,16 +30,7 @@ Assert that files created by the RPM packager will be removed by 'scons -c'. import TestSCons -machine = TestSCons.machine -try: - # Try to get the actual machine type (like i586), since - # TestSCons maps all ix86 types to a i386 machine internally. - import os - machine = os.uname()[4] -except AttributeError: - pass _python_ = TestSCons._python_ - test = TestSCons.TestSCons() scons = test.program @@ -97,9 +88,9 @@ test.up_to_date( arguments='.' ) test.run( arguments='-c .' ) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine +machine_rpm = 'foo-1.2.3-0.*.rpm' -test.must_not_exist( machine_rpm ) +test.must_not_exist_any_of( [machine_rpm] ) test.must_not_exist( src_rpm ) test.must_not_exist( 'foo-1.2.3.tar.gz' ) test.must_not_exist( 'foo-1.2.3.spec' ) diff --git a/test/packaging/rpm/internationalization.py b/test/packaging/rpm/internationalization.py index a9bd926..4b75de4 100644 --- a/test/packaging/rpm/internationalization.py +++ b/test/packaging/rpm/internationalization.py @@ -32,17 +32,10 @@ These are x-rpm-Group, description, summary and the lang_xx file tag. """ import os +import glob import TestSCons -machine = TestSCons.machine -try: - # Try to get the actual machine type (like i586), since - # TestSCons maps all ix86 types to a i386 machine internally. - import os - machine = os.uname()[4] -except AttributeError: - pass _python_ = TestSCons._python_ test = TestSCons.TestSCons() @@ -102,29 +95,30 @@ env.Alias ( 'install', prog ) test.run(arguments='', stderr = None) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine +machine_rpm = 'foo-1.2.3-0.*.rpm' test.must_exist( src_rpm ) -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.must_not_exist( 'bin/main' ) +machine_rpm_path = glob.glob(machine_rpm)[0].lstrip('./') cmd = 'rpm -qp --queryformat \'%%{GROUP}-%%{SUMMARY}-%%{DESCRIPTION}\' %s' os.environ['LANGUAGE'] = 'de' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() +out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() test.fail_test( out != 'Applikation/büro-hallo-das sollte wirklich lang sein' ) os.environ['LANGUAGE'] = 'fr' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() +out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() test.fail_test( out != 'Application/bureau-bonjour-ceci devrait être vraiment long' ) os.environ['LANGUAGE'] = 'en' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() +out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() test.fail_test( out != 'Application/office-hello-this should be really long' ) os.environ['LC_ALL'] = 'ae' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() +out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() test.fail_test( out != 'Application/office-hello-this should be really long' ) # @@ -183,7 +177,7 @@ env.Alias ( 'install', [ prog, man_pages ] ) test.run(arguments='--install-sandbox=blubb install', stderr = None) test.must_exist( src_rpm ) -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.pass_test() diff --git a/test/packaging/rpm/multipackage.py b/test/packaging/rpm/multipackage.py index 4f10a8a..4807a20 100644 --- a/test/packaging/rpm/multipackage.py +++ b/test/packaging/rpm/multipackage.py @@ -30,16 +30,9 @@ from one SCons environment. """ import os +import glob import TestSCons -machine = TestSCons.machine -try: - # Try to get the actual machine type (like i586), since - # TestSCons maps all ix86 types to a i386 machine internally. - import os - machine = os.uname()[4] -except AttributeError: - pass _python_ = TestSCons._python_ test = TestSCons.TestSCons() @@ -105,18 +98,18 @@ env.Alias( 'install', prog ) test.run(arguments='', stderr = None) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine +machine_rpm = 'foo-1.2.3-0.*.rpm' src_rpm2 = 'foo2-1.2.3-0.src.rpm' -machine_rpm2 = 'foo2-1.2.3-0.%s.rpm' % machine +machine_rpm2 = 'foo2-1.2.3-0.*.rpm' -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.must_exist( src_rpm ) -test.must_exist( machine_rpm2 ) +test.must_exist_one_of( [machine_rpm2] ) test.must_exist( src_rpm2 ) test.must_not_exist( 'bin/main' ) -test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n') +test.fail_test( not os.popen('rpm -qpl %s' % glob.glob(machine_rpm)[0].lstrip('./')).read()=='/bin/main\n') test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n') test.pass_test() diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py index 3a55e33..b1abaab 100644 --- a/test/packaging/rpm/package.py +++ b/test/packaging/rpm/package.py @@ -29,16 +29,9 @@ Test the ability to create a really simple rpm package. """ import os +import glob import TestSCons -machine = TestSCons.machine -try: - # Try to get the actual machine type (like i586), since - # TestSCons maps all ix86 types to a i386 machine internally. - import os - machine = os.uname()[4] -except AttributeError: - pass _python_ = TestSCons._python_ test = TestSCons.TestSCons() @@ -90,12 +83,12 @@ env.Alias( 'install', prog ) test.run(arguments='', stderr = None) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine +machine_rpm = 'foo-1.2.3-0.*.rpm' -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.must_exist( src_rpm ) test.must_not_exist( 'bin/main' ) -test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n') +test.fail_test( not os.popen('rpm -qpl %s' % glob.glob(machine_rpm)[0].lstrip('./')).read()=='/bin/main\n') test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n') test.pass_test() diff --git a/test/packaging/rpm/tagging.py b/test/packaging/rpm/tagging.py index 4e43d93..4d6c76e 100644 --- a/test/packaging/rpm/tagging.py +++ b/test/packaging/rpm/tagging.py @@ -29,17 +29,10 @@ Test the ability to add file tags """ import os +import glob import TestSCons -machine = TestSCons.machine -try: - # Try to get the actual machine type (like i586), since - # TestSCons maps all ix86 types to a i386 machine internally. - import os - machine = os.uname()[4] -except AttributeError: - pass _python_ = TestSCons._python_ test = TestSCons.TestSCons() @@ -95,11 +88,11 @@ env.Package( NAME = 'foo', test.run(arguments='', stderr = None) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.%s.rpm' % machine +machine_rpm = 'foo-1.2.3-0.*.rpm' -test.must_exist( machine_rpm ) +test.must_exist_one_of( [machine_rpm] ) test.must_exist( src_rpm ) -test.fail_test( not os.popen('rpm -qpl %s' % machine_rpm).read()=='/bin/main\n') +test.fail_test( not os.popen('rpm -qpl %s' % glob.glob(machine_rpm)[0].lstrip('./')).read()=='/bin/main\n') test.fail_test( not os.popen('rpm -qpl %s' % src_rpm).read()=='foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n') expect = '(0755, root, users) /bin/main' |