Introduce a configure() method into client/common_lib/util.py which does
some extra env var look up to honor cross compiling.
This change was tested under our build environment.
Risk: Very low and should be transparent to existing autotest users. Unless
you are working on cross compiling stuff.
Index: client/tests/iperf/iperf.py
===================================================================
--- client/tests/iperf/iperf.py (revision 4377)
+++ client/tests/iperf/iperf.py (working copy)
@@ -16,7 +16,7 @@
utils.extract_tarball_to_dir(tarball, self.srcdir)
os.chdir(self.srcdir)
- utils.system('./configure')
+ utils.configure()
utils.system('make')
utils.system('sync')
Index: client/tests/dbench/dbench.py
===================================================================
--- client/tests/dbench/dbench.py (revision 4377)
+++ client/tests/dbench/dbench.py (working copy)
@@ -12,14 +12,7 @@
os.chdir(self.srcdir)
utils.system('patch -p1 < ../dbench_startup.patch')
- # CBUILD and CHOST is env vars used inside Chromium OS build
environment
- # for cross compiling.
- if 'CBUILD' in os.environ and 'CHOST' in os.environ:
- config_params = '--build=%s --host=%s' % (os.environ['CBUILD'],
- os.environ['CHOST'])
- else:
- config_params = ''
- utils.system('./configure %s' % config_params)
+ utils.configure()
utils.system('make')
Index: client/tests/netperf2/netperf2.py
===================================================================
--- client/tests/netperf2/netperf2.py (revision 4377)
+++ client/tests/netperf2/netperf2.py (working copy)
@@ -21,7 +21,7 @@
# CPU_SET_S defined on /usr/include/sched.h, backported from
# upstream svn trunk
utils.system('patch -p0 < ../fix_netperf_build.patch')
- utils.system('./configure')
+ utils.configure()
utils.system('make')
utils.system('sync')
Index: client/common_lib/utils.py
===================================================================
--- client/common_lib/utils.py (revision 4377)
+++ client/common_lib/utils.py (working copy)
@@ -1247,3 +1247,24 @@
command = command.replace('"', r'\"')
command = command.replace('`', r'\`')
return command
+
+
+def configure(extra=None, configure='./configure'):
+ """
+ Run configure passing in the correct host, build, and target options.
+
+ @param extra: extra command line arguments to pass to configure
+ @param configure: which configure script to use
+ """
+ args = []
+ if 'CHOST' in os.environ:
+ args.append('--host=' + os.environ['CHOST'])
+ if 'CBUILD' in os.environ:
+ args.append('--build=' + os.environ['CBUILD'])
+ if 'CTARGET' in os.environ:
+ args.append('--target=' + os.environ['CTARGET'])
+ if extra:
+ args.append(extra)
+
+ system('%s %s' % (configure, ' '.join(args)))
+
--
Eric Li
李咏竹
Google Kirkland
Index: client/tests/iperf/iperf.py
===================================================================
--- client/tests/iperf/iperf.py (revision 4377)
+++ client/tests/iperf/iperf.py (working copy)
@@ -16,7 +16,7 @@
utils.extract_tarball_to_dir(tarball, self.srcdir)
os.chdir(self.srcdir)
- utils.system('./configure')
+ utils.configure()
utils.system('make')
utils.system('sync')
Index: client/tests/dbench/dbench.py
===================================================================
--- client/tests/dbench/dbench.py (revision 4377)
+++ client/tests/dbench/dbench.py (working copy)
@@ -12,14 +12,7 @@
os.chdir(self.srcdir)
utils.system('patch -p1 < ../dbench_startup.patch')
- # CBUILD and CHOST is env vars used inside Chromium OS build
environment
- # for cross compiling.
- if 'CBUILD' in os.environ and 'CHOST' in os.environ:
- config_params = '--build=%s --host=%s' % (os.environ['CBUILD'],
- os.environ['CHOST'])
- else:
- config_params = ''
- utils.system('./configure %s' % config_params)
+ utils.configure()
utils.system('make')
Index: client/tests/netperf2/netperf2.py
===================================================================
--- client/tests/netperf2/netperf2.py (revision 4377)
+++ client/tests/netperf2/netperf2.py (working copy)
@@ -21,7 +21,7 @@
# CPU_SET_S defined on /usr/include/sched.h, backported from
# upstream svn trunk
utils.system('patch -p0 < ../fix_netperf_build.patch')
- utils.system('./configure')
+ utils.configure()
utils.system('make')
utils.system('sync')
Index: client/common_lib/utils.py
===================================================================
--- client/common_lib/utils.py (revision 4377)
+++ client/common_lib/utils.py (working copy)
@@ -1247,3 +1247,24 @@
command = command.replace('"', r'\"')
command = command.replace('`', r'\`')
return command
+
+
+def configure(extra=None, configure='./configure'):
+ """
+ Run configure passing in the correct host, build, and target options.
+
+ @param extra: extra command line arguments to pass to configure
+ @param configure: which configure script to use
+ """
+ args = []
+ if 'CHOST' in os.environ:
+ args.append('--host=' + os.environ['CHOST'])
+ if 'CBUILD' in os.environ:
+ args.append('--build=' + os.environ['CBUILD'])
+ if 'CTARGET' in os.environ:
+ args.append('--target=' + os.environ['CTARGET'])
+ if extra:
+ args.append(extra)
+
+ system('%s %s' % (configure, ' '.join(args)))
+
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest