comparison tests/run-tests.py @ 49832:9a4c76cc8fe6 stable

run-tests: support --pyoxidized on macOS We should definitely be able to test this before releasing it with an installer.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 05 Dec 2022 11:49:56 -0500
parents 1baf0fffd82f
children a2356e15200a
comparison
equal deleted inserted replaced
49831:d5b722ce9864 49832:9a4c76cc8fe6
84 '%s is only supported on Python 3.5+, not %s' 84 '%s is only supported on Python 3.5+, not %s'
85 % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3])) 85 % (sys.argv[0], '.'.join(str(v) for v in sys.version_info[:3]))
86 ) 86 )
87 sys.exit(70) # EX_SOFTWARE from `man 3 sysexit` 87 sys.exit(70) # EX_SOFTWARE from `man 3 sysexit`
88 88
89 MACOS = sys.platform == 'darwin'
89 WINDOWS = os.name == r'nt' 90 WINDOWS = os.name == r'nt'
90 shellquote = shlex.quote 91 shellquote = shlex.quote
91 92
92 93
93 processlock = threading.Lock() 94 processlock = threading.Lock()
743 744
744 if (options.chg or options.with_chg) and WINDOWS: 745 if (options.chg or options.with_chg) and WINDOWS:
745 parser.error('chg does not work on %s' % os.name) 746 parser.error('chg does not work on %s' % os.name)
746 if (options.rhg or options.with_rhg) and WINDOWS: 747 if (options.rhg or options.with_rhg) and WINDOWS:
747 parser.error('rhg does not work on %s' % os.name) 748 parser.error('rhg does not work on %s' % os.name)
748 if options.pyoxidized and not WINDOWS: 749 if options.pyoxidized and not (MACOS or WINDOWS):
749 parser.error('--pyoxidized is currently Windows only') 750 parser.error('--pyoxidized is currently macOS and Windows only')
750 if options.with_chg: 751 if options.with_chg:
751 options.chg = False # no installation to temporary location 752 options.chg = False # no installation to temporary location
752 options.with_chg = canonpath(_sys2bytes(options.with_chg)) 753 options.with_chg = canonpath(_sys2bytes(options.with_chg))
753 if not ( 754 if not (
754 os.path.isfile(options.with_chg) 755 os.path.isfile(options.with_chg)
3203 3204
3204 if self.options.pyoxidized: 3205 if self.options.pyoxidized:
3205 testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0]))) 3206 testdir = os.path.dirname(_sys2bytes(canonpath(sys.argv[0])))
3206 reporootdir = os.path.dirname(testdir) 3207 reporootdir = os.path.dirname(testdir)
3207 # XXX we should ideally install stuff instead of using the local build 3208 # XXX we should ideally install stuff instead of using the local build
3208 bin_path = ( 3209
3209 b'build/pyoxidizer/x86_64-pc-windows-msvc/release/app/hg.exe' 3210 exe = b'hg'
3210 ) 3211 triple = b''
3212
3213 if WINDOWS:
3214 triple = b'x86_64-pc-windows-msvc'
3215 exe = b'hg.exe'
3216 elif MACOS:
3217 # TODO: support Apple silicon too
3218 triple = b'x86_64-apple-darwin'
3219
3220 bin_path = b'build/pyoxidizer/%s/release/app/%s' % (triple, exe)
3211 full_path = os.path.join(reporootdir, bin_path) 3221 full_path = os.path.join(reporootdir, bin_path)
3212 self._hgcommand = full_path 3222 self._hgcommand = full_path
3213 # Affects hghave.py 3223 # Affects hghave.py
3214 osenvironb[b'PYOXIDIZED_INSTALLED_AS_HG'] = b'1' 3224 osenvironb[b'PYOXIDIZED_INSTALLED_AS_HG'] = b'1'
3215 else: 3225 else:
3849 build binary to testing quickly. 3859 build binary to testing quickly.
3850 """ 3860 """
3851 vlog('# build a pyoxidized version of Mercurial') 3861 vlog('# build a pyoxidized version of Mercurial')
3852 assert os.path.dirname(self._bindir) == self._installdir 3862 assert os.path.dirname(self._bindir) == self._installdir
3853 assert self._hgroot, 'must be called after _installhg()' 3863 assert self._hgroot, 'must be called after _installhg()'
3854 cmd = b'"%(make)s" pyoxidizer-windows-tests' % { 3864 target = b''
3865 if WINDOWS:
3866 target = b'windows'
3867 elif MACOS:
3868 target = b'macos'
3869
3870 cmd = b'"%(make)s" pyoxidizer-%(platform)s-tests' % {
3855 b'make': b'make', 3871 b'make': b'make',
3872 b'platform': target,
3856 } 3873 }
3857 cwd = self._hgroot 3874 cwd = self._hgroot
3858 vlog("# Running", cmd) 3875 vlog("# Running", cmd)
3859 proc = subprocess.Popen( 3876 proc = subprocess.Popen(
3860 _bytes2sys(cmd), 3877 _bytes2sys(cmd),