Bug 933135 - Treat SIMPLE_PROGRAMS more like PROGRAM. r=mshal
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 02 Nov 2013 08:43:55 +0900
changeset 162238 c2e49620960848a9fe2c0b41394dc4b0791a0769
parent 162237 07cb03648addc28afa2ef8a2eb5bc77c3e4132ac
child 162239 53170bea23a65f04655f33cde223d40ce8e52691
push idunknown
push userunknown
push dateunknown
reviewersmshal
bugs933135
milestone28.0a1
Bug 933135 - Treat SIMPLE_PROGRAMS more like PROGRAM. r=mshal
intl/uconv/tools/moz.build
intl/unicharutil/tests/moz.build
mozglue/tests/moz.build
netwerk/test/moz.build
python/mozbuild/mozbuild/backend/recursivemake.py
python/mozbuild/mozbuild/frontend/data.py
python/mozbuild/mozbuild/frontend/emitter.py
python/mozbuild/mozbuild/frontend/sandbox_symbols.py
python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
python/mozbuild/mozbuild/test/backend/test_recursivemake.py
python/mozbuild/mozbuild/test/frontend/data/program/moz.build
python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
python/mozbuild/mozbuild/test/frontend/test_emitter.py
security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
toolkit/mozapps/plugins/tests/moz.build
toolkit/mozapps/update/tests/moz.build
toolkit/xre/test/win/moz.build
tools/trace-malloc/moz.build
uriloader/exthandler/tests/moz.build
xpcom/reflect/xptcall/tests/moz.build
xpcom/reflect/xptinfo/tests/moz.build
xpcom/sample/program/moz.build
xpcom/tests/external/moz.build
xpcom/tests/moz.build
xpcom/typelib/xpt/tests/moz.build
xpcom/windbgdlg/moz.build
--- a/intl/uconv/tools/moz.build
+++ b/intl/uconv/tools/moz.build
@@ -1,19 +1,13 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-sources = [
+SIMPLE_PROGRAMS += [
     'umaptable',
 ]
 
 SOURCES += [
-    '%s.c' % s for s in sources
+    '%s.c' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
-
--- a/intl/unicharutil/tests/moz.build
+++ b/intl/unicharutil/tests/moz.build
@@ -8,12 +8,11 @@ MODULE = 'test_intl_unicharutil'
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
 
 SOURCES += [
     'NormalizationTest.cpp',
     'UnicharSelfTest.cpp',
 ]
 
-bin_suffix = CONFIG['BIN_SUFFIX']
 SIMPLE_PROGRAMS += [
-    "%s%s" % (fyl[0:-4], bin_suffix) for fyl in SOURCES
+    "%s" % (fyl[0:-4]) for fyl in SOURCES
 ]
--- a/mozglue/tests/moz.build
+++ b/mozglue/tests/moz.build
@@ -7,10 +7,10 @@
 NO_DIST_INSTALL = True
 
 if CONFIG['MOZ_LINKER']:
     SOURCES += [
         'ShowSSEConfig.cpp',
         'TestZip.cpp',
     ]
     SIMPLE_PROGRAMS += [
-        'TestZip' + CONFIG['BIN_SUFFIX'],
+        'TestZip',
     ]
--- a/netwerk/test/moz.build
+++ b/netwerk/test/moz.build
@@ -11,17 +11,17 @@ FAIL_ON_WARNINGS = True
 MODULE = 'test_necko'
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
 
 # FIXME/bug 575918: out-of-process xpcshell is broken on OS X
 if CONFIG['OS_ARCH'] != 'Darwin':
     XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']
 
-sources = [
+SIMPLE_PROGRAMS = [
     'PropertiesTest',
     'ReadNTLM',
     'TestBlockingSocket',
     'TestCallbacks',
     'TestCookie',
     'TestDNS',
     'TestIncrementalDownload',
     'TestOpen',
@@ -31,33 +31,28 @@ sources = [
     'TestStandardURL',
     'TestStreamLoader',
     'TestUpload',
     'TestURLParser',
     'urltest',
 ]
 
 # XXX Make this work in libxul builds.
-#sources += [
+#SIMPLE_PROGRAMS += [
 #    TestIDN',
 #    TestIOThreads',
 #    TestPerf',
 #    TestSocketTransport',
 #    TestStreamChannel',
 #    TestStreamPump',
 #    TestStreamTransport',
 #    TestUDPSocketProvider',
 #]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
-]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
 
 CPP_UNIT_TESTS += [
     'TestSTSParser.cpp',
     'TestUDPServerSocket.cpp',
 ]
 
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -33,16 +33,17 @@ from ..frontend.data import (
     IPDLFile,
     JavaJarData,
     LocalInclude,
     PreprocessedTestWebIDLFile,
     PreprocessedWebIDLFile,
     Program,
     SandboxDerived,
     SandboxWrapped,
+    SimpleProgram,
     TestWebIDLFile,
     VariablePassthru,
     XPIDLFile,
     TestManifest,
     WebIDLFile,
 )
 from ..util import (
     ensureParentDir,
@@ -408,16 +409,19 @@ class RecursiveMakeBackend(CommonBackend
         elif isinstance(obj, PreprocessedWebIDLFile):
             self._preprocessed_webidl_sources.add(mozpath.join(obj.srcdir,
                                                                obj.basename))
             self._process_webidl_basename(obj.basename)
 
         elif isinstance(obj, Program):
             self._process_program(obj.program, backend_file)
 
+        elif isinstance(obj, SimpleProgram):
+            self._process_simple_program(obj.program, backend_file)
+
         elif isinstance(obj, TestManifest):
             self._process_test_manifest(obj, backend_file)
 
         elif isinstance(obj, LocalInclude):
             self._process_local_include(obj.path, backend_file)
 
         elif isinstance(obj, GeneratedInclude):
             self._process_generated_include(obj.path, backend_file)
@@ -963,16 +967,19 @@ class RecursiveMakeBackend(CommonBackend
         # The Makefile can't regenerate itself because of custom substitution.
         # We need to list it here to ensure changes cause regeneration.
         self.backend_input_files.add(os.path.join(self.environment.topsrcdir,
             'config', 'makefiles', 'xpidl', 'Makefile.in'))
 
     def _process_program(self, program, backend_file):
         backend_file.write('PROGRAM = %s\n' % program)
 
+    def _process_simple_program(self, program, backend_file):
+        backend_file.write('SIMPLE_PROGRAMS += %s\n' % program)
+
     def _process_webidl_basename(self, basename):
         header = 'mozilla/dom/%sBinding.h' % os.path.splitext(basename)[0]
         self._install_manifests['dist_include'].add_optional_exists(header)
 
     def _process_test_manifest(self, obj, backend_file):
         # Much of the logic in this function could be moved to CommonBackend.
         self.backend_input_files.add(os.path.join(obj.topsrcdir,
             obj.manifest_relpath))
--- a/python/mozbuild/mozbuild/frontend/data.py
+++ b/python/mozbuild/mozbuild/frontend/data.py
@@ -274,35 +274,44 @@ class GeneratedWebIDLFile(SandboxDerived
         'basename',
     )
 
     def __init__(self, sandbox, path):
         SandboxDerived.__init__(self, sandbox)
 
         self.basename = path
 
-class Program(SandboxDerived):
-    """Sandbox container object for PROGRAM, which is a unicode string.
+class BaseProgram(SandboxDerived):
+    """Sandbox container object for programs, which is a unicode string.
 
-    This class handles automatically appending BIN_SUFFIX to the PROGRAM value.
-    If BIN_SUFFIX is not defined, PROGRAM is unchanged.
-    Otherwise, if PROGRAM ends in BIN_SUFFIX, it is unchanged
-    Otherwise, BIN_SUFFIX is appended to PROGRAM
+    This class handles automatically appending a binary suffix to the program
+    name.
+    If the suffix is not defined, the program name is unchanged.
+    Otherwise, if the program name ends with the given suffix, it is unchanged
+    Otherwise, the suffix is appended to the program name.
     """
     __slots__ = ('program')
 
     def __init__(self, sandbox, program, bin_suffix):
         SandboxDerived.__init__(self, sandbox)
 
         bin_suffix = bin_suffix or ''
         if not program.endswith(bin_suffix):
             program += bin_suffix
         self.program = program
 
 
+class Program(BaseProgram):
+    """Sandbox container object for PROGRAM"""
+
+
+class SimpleProgram(BaseProgram):
+    """Sandbox container object for each program in SIMPLE_PROGRAMS"""
+
+
 class TestManifest(SandboxDerived):
     """Represents a manifest file containing information about tests."""
 
     __slots__ = (
         # The type of test manifest this is.
         'flavor',
 
         # Maps source filename to destination filename. The destination
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -29,16 +29,17 @@ from .data import (
     InstallationTarget,
     IPDLFile,
     LocalInclude,
     PreprocessedTestWebIDLFile,
     PreprocessedWebIDLFile,
     Program,
     ReaderSummary,
     SandboxWrapped,
+    SimpleProgram,
     TestWebIDLFile,
     TestManifest,
     VariablePassthru,
     WebIDLFile,
     XPIDLFile,
 )
 
 from .reader import (
@@ -159,17 +160,16 @@ class TreeMetadataEmitter(LoggingMixin):
             LIBS='LIBS',
             LIBXUL_LIBRARY='LIBXUL_LIBRARY',
             MODULE='MODULE',
             MSVC_ENABLE_PGO='MSVC_ENABLE_PGO',
             NO_DIST_INSTALL='NO_DIST_INSTALL',
             OS_LIBS='OS_LIBS',
             SDK_LIBRARY='SDK_LIBRARY',
             SHARED_LIBRARY_LIBS='SHARED_LIBRARY_LIBS',
-            SIMPLE_PROGRAMS='SIMPLE_PROGRAMS',
         )
         for mak, moz in varmap.items():
             if sandbox[moz]:
                 passthru.variables[mak] = sandbox[moz]
 
         # NO_VISIBILITY_FLAGS is slightly different
         if sandbox['NO_VISIBILITY_FLAGS']:
             passthru.variables['VISIBILITY_FLAGS'] = ''
@@ -227,16 +227,19 @@ class TreeMetadataEmitter(LoggingMixin):
         defines = sandbox.get('DEFINES')
         if defines:
             yield Defines(sandbox, defines)
 
         program = sandbox.get('PROGRAM')
         if program:
             yield Program(sandbox, program, sandbox['CONFIG']['BIN_SUFFIX'])
 
+        for program in sandbox['SIMPLE_PROGRAMS']:
+            yield SimpleProgram(sandbox, program, sandbox['CONFIG']['BIN_SUFFIX'])
+
         simple_lists = [
             ('GENERATED_EVENTS_WEBIDL_FILES', GeneratedEventWebIDLFile),
             ('GENERATED_WEBIDL_FILES', GeneratedWebIDLFile),
             ('IPDL_SOURCES', IPDLFile),
             ('LOCAL_INCLUDES', LocalInclude),
             ('GENERATED_INCLUDES', GeneratedInclude),
             ('PREPROCESSED_TEST_WEBIDL_FILES', PreprocessedTestWebIDLFile),
             ('PREPROCESSED_WEBIDL_FILES', PreprocessedWebIDLFile),
--- a/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
+++ b/python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ -302,20 +302,24 @@ VARIABLES = {
     'SHARED_LIBRARY_LIBS': (StrictOrderingOnAppendList, list, [],
         """Libraries linked into a shared library.
 
         A list of static library paths which should be linked into the
         current shared library.
         """, None),
 
     'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list, [],
-        """Generate a list of binaries from source.
+        """Compile a list of executable names.
 
-        A list of sources, one per program, to compile & link with libs
-        into standalone programs.
+        Each name in this variable corresponds to an executable built from the
+        corresponding source file with the same base name.
+
+        If the configuration token ``BIN_SUFFIX`` is set, its value will be
+        automatically appended to each name. If a name already ends with
+        ``BIN_SUFFIX``, the name will remain unchanged.
         """, 'binaries'),
 
     'TOOL_DIRS': (list, list, [],
         """Like DIRS but for tools.
 
         Tools are for pieces of the build system that aren't required to
         produce a working binary (in theory). They provide things like test
         code and utilities.
--- a/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/variable_passthru/moz.build
@@ -27,18 +27,16 @@ LIBRARY_NAME = 'lib_name'
 LIBS = ['bar.lib', 'foo.lib']
 
 OS_LIBS = ['foo.so', '-l123', 'bar.a']
 
 SDK_LIBRARY = ['bar.sdk', 'foo.sdk']
 
 SHARED_LIBRARY_LIBS += ['bar.sll', 'foo.sll']
 
-SIMPLE_PROGRAMS = ['bar.x', 'foo.x']
-
 SOURCES += ['bar.c', 'foo.c']
 
 SOURCES += ['bar.mm', 'foo.mm']
 
 SOURCES += ['baz.S', 'foo.S']
 
 FAIL_ON_WARNINGS = True
 LIBXUL_LIBRARY = True
--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
@@ -341,20 +341,16 @@ class TestRecursiveMakeBackend(BackendTe
             'SDK_LIBRARY': [
                 'SDK_LIBRARY += bar.sdk',
                 'SDK_LIBRARY += foo.sdk',
             ],
             'SHARED_LIBRARY_LIBS': [
                 'SHARED_LIBRARY_LIBS += bar.sll',
                 'SHARED_LIBRARY_LIBS += foo.sll',
             ],
-            'SIMPLE_PROGRAMS': [
-                'SIMPLE_PROGRAMS += bar.x',
-                'SIMPLE_PROGRAMS += foo.x',
-            ],
             'SSRCS': [
                 'SSRCS += baz.S',
                 'SSRCS += foo.S',
             ],
             'VISIBILITY_FLAGS': [
                 'VISIBILITY_FLAGS :=',
             ],
         }
--- a/python/mozbuild/mozbuild/test/frontend/data/program/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/program/moz.build
@@ -1,4 +1,6 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
 PROGRAM = 'test_program'
+
+SIMPLE_PROGRAMS = [ 'test_program1', 'test_program2' ]
--- a/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/variable-passthru/moz.build
@@ -27,18 +27,16 @@ LIBRARY_NAME = 'lib_name'
 LIBS += ['fans.lib', 'tans.lib']
 
 OS_LIBS += ['foo.so', '-l123', 'aaa.a']
 
 SDK_LIBRARY += ['fans.sdk', 'tans.sdk']
 
 SHARED_LIBRARY_LIBS += ['fans.sll', 'tans.sll']
 
-SIMPLE_PROGRAMS += ['fans.x', 'tans.x']
-
 SOURCES += ['fans.c', 'tans.c']
 
 SOURCES += ['fans.mm', 'tans.mm']
 
 SOURCES += ['bans.S', 'fans.S']
 
 FAIL_ON_WARNINGS = True
 LIBXUL_LIBRARY = True
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -6,26 +6,27 @@ from __future__ import unicode_literals
 
 import os
 import unittest
 
 from mozunit import main
 
 from mozbuild.frontend.data import (
     ConfigFileSubstitution,
+    Defines,
     DirectoryTraversal,
-    ReaderSummary,
-    VariablePassthru,
-    Defines,
     Exports,
     GeneratedInclude,
-    Program,
     IPDLFile,
     LocalInclude,
+    Program,
+    ReaderSummary,
+    SimpleProgram,
     TestManifest,
+    VariablePassthru,
 )
 from mozbuild.frontend.emitter import TreeMetadataEmitter
 from mozbuild.frontend.reader import (
     BuildReader,
     SandboxValidationError,
 )
 
 from mozbuild.test.common import MockConfig
@@ -156,17 +157,16 @@ class TestEmitterBasic(unittest.TestCase
             LIBS=['fans.lib', 'tans.lib'],
             LIBXUL_LIBRARY=True,
             MSVC_ENABLE_PGO=True,
             NO_DIST_INSTALL=True,
             MODULE='module_name',
             OS_LIBS=['foo.so', '-l123', 'aaa.a'],
             SDK_LIBRARY=['fans.sdk', 'tans.sdk'],
             SHARED_LIBRARY_LIBS=['fans.sll', 'tans.sll'],
-            SIMPLE_PROGRAMS=['fans.x', 'tans.x'],
             SSRCS=['bans.S', 'fans.S'],
             VISIBILITY_FLAGS='',
         )
 
         variables = objs[1].variables
         maxDiff = self.maxDiff
         self.maxDiff = None
         self.assertEqual(wanted, variables)
@@ -208,22 +208,25 @@ class TestEmitterBasic(unittest.TestCase
         self.assertIn('overwrite', exports._children)
         overwrite = exports._children['overwrite']
         self.assertEqual(overwrite.get_strings(), ['new.h'])
 
     def test_program(self):
         reader = self.reader('program')
         objs = self.read_topsrcdir(reader)
 
-        self.assertEqual(len(objs), 2)
+        self.assertEqual(len(objs), 4)
         self.assertIsInstance(objs[0], DirectoryTraversal)
         self.assertIsInstance(objs[1], Program)
+        self.assertIsInstance(objs[2], SimpleProgram)
+        self.assertIsInstance(objs[3], SimpleProgram)
 
-        program = objs[1].program
-        self.assertEqual(program, 'test_program.prog')
+        self.assertEqual(objs[1].program, 'test_program.prog')
+        self.assertEqual(objs[2].program, 'test_program1.prog')
+        self.assertEqual(objs[3].program, 'test_program2.prog')
 
     def test_test_manifest_missing_manifest(self):
         """A missing manifest file should result in an error."""
         reader = self.reader('test-manifest-missing-manifest')
 
         with self.assertRaisesRegexp(SandboxValidationError, 'IOError: Missing files'):
             self.read_topsrcdir(reader)
 
--- a/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
+++ b/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
@@ -3,20 +3,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'tlsserver'
 
 FAIL_ON_WARNINGS = True
 
-sources = [
+SIMPLE_PROGRAMS = [
     'OCSPStaplingServer',
 ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
--- a/toolkit/mozapps/plugins/tests/moz.build
+++ b/toolkit/mozapps/plugins/tests/moz.build
@@ -1,21 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'test_plugins'
 
-sources = [
+SIMPLE_PROGRAMS = [
     'BadPlugin',
     'GoodPlugin',
 ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -8,21 +8,16 @@ XPCSHELL_TESTS_MANIFESTS += ['unit_aus_u
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
     MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
     XPCSHELL_TESTS_MANIFESTS += ['unit_base_updater/xpcshell.ini']
 
     if CONFIG['MOZ_MAINTENANCE_SERVICE']:
         XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini']
 
-    sources = [
+    SIMPLE_PROGRAMS = [
         'TestAUSHelper',
         'TestAUSReadStrings',
     ]
 
     SOURCES += [
-        '%s.cpp' % s for s in sources
+        '%s.cpp' % s for s in SIMPLE_PROGRAMS
     ]
-
-    bin_suffix = CONFIG['BIN_SUFFIX']
-    SIMPLE_PROGRAMS += [
-        '%s%s' % (s, bin_suffix) for s in sources
-    ]
--- a/toolkit/xre/test/win/moz.build
+++ b/toolkit/xre/test/win/moz.build
@@ -1,22 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'test_xulapp'
 
-sources = [
+SIMPLE_PROGRAMS = [
     'TestDllInterceptor',
     'TestXREMakeCommandLineWin',
 ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
-
--- a/tools/trace-malloc/moz.build
+++ b/tools/trace-malloc/moz.build
@@ -22,26 +22,20 @@ simple_c_sources = [
 
 SOURCES += [
     '%s.c' % s for s in simple_c_sources
 ]
 SOURCES += [
     'tmreader.c',
 ]
 
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in simple_c_sources
-]
-
+SIMPLE_PROGRAMS += simple_c_sources
 
 simple_cpp_sources = [
     'bloatblame',
     'leaksoup',
 ]
 
 SOURCES += [
     '%s.cpp' % s for s in simple_cpp_sources
 ]
 
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in simple_cpp_sources
-]
-
+SIMPLE_PROGRAMS += simple_cpp_sources
--- a/uriloader/exthandler/tests/moz.build
+++ b/uriloader/exthandler/tests/moz.build
@@ -14,21 +14,15 @@ XPCSHELL_TESTS_MANIFESTS += ['unit/xpcsh
 
 #FIXME/bug 575918: out-of-process xpcshell is broken on OS X
 if CONFIG['OS_ARCH'] != 'Darwin':
     # The encoding test is already implemented in the Downloads API by a set of
     # test cases with the string "content_encoding" in their names.
     if not CONFIG['MOZ_JSDOWNLOADS']:
         XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']
 
-sources = [
+SIMPLE_PROGRAMS = [
     'WriteArgument',
 ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
-
--- a/xpcom/reflect/xptcall/tests/moz.build
+++ b/xpcom/reflect/xptcall/tests/moz.build
@@ -1,20 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'TestXPTC'
 
-sources = [
+SIMPLE_PROGRAMS = [
     'TestXPTCInvoke',
 ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
-
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
-
--- a/xpcom/reflect/xptinfo/tests/moz.build
+++ b/xpcom/reflect/xptinfo/tests/moz.build
@@ -6,10 +6,10 @@
 
 MODULE = 'xpcom'
 
 SOURCES += [
     'TestInterfaceInfo.cpp',
 ]
 
 SIMPLE_PROGRAMS += [
-    "TestInterfaceInfo%s" % (CONFIG['BIN_SUFFIX']),
+    'TestInterfaceInfo'
 ]
--- a/xpcom/sample/program/moz.build
+++ b/xpcom/sample/program/moz.build
@@ -9,10 +9,10 @@ MODULE = 'xpcomsample'
 # We must specify CPP_SOURCES in order to link using the proper c++ linker
 # on certain platforms.
 SOURCES += [
     'nsTestSample.cpp',
 ]
 
 # SIMPLE_PROGRAMS compiles a single .cpp file into an executable
 SIMPLE_PROGRAMS += [
-    "nsTestSample%s" % (CONFIG['BIN_SUFFIX']),
+    'nsTestSample'
 ]
--- a/xpcom/tests/external/moz.build
+++ b/xpcom/tests/external/moz.build
@@ -1,20 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'xpcom'
 
-sources = [
+SIMPLE_PROGRAMS = [
     'TestMinStringAPI',
 ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sources
+    '%s.cpp' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -18,48 +18,43 @@ if CONFIG['DEHYDRA_PATH']:
     TEST_TOOL_DIRS += ['static-checker']
 
 FAIL_ON_WARNINGS = True
 
 EXPORTS.testing += [
     'TestHarness.h',
 ]
 
-sources = [
+SIMPLE_PROGRAMS = [
     'nsIFileEnumerator',
     'TestArguments',
     'TestBlockingProcess',
     'TestCallTemplates',
     'TestINIParser',
     'TestPRIntN',
     'TestQuickReturn',
     'TestRacingServiceManager',
     'TestRegistrationOrder',
     'TestThreadPoolListener',
     'TestTimers',
     'TestUnicodeArguments',
 ]
 
 if CONFIG['OS_TARGET'] == 'WINNT':
-    sources += [
+    SIMPLE_PROGRAMS += [
         'TestBase64',
     ]
 
 if CONFIG['WRAP_STL_INCLUDES']:
-    sources += [
+    SIMPLE_PROGRAMS += [
         'TestSTLWrappers',
     ]
 
 SOURCES += [
-    '%s.cpp' % s for s in sorted(sources)
-]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sorted(sources)
+    '%s.cpp' % s for s in sorted(SIMPLE_PROGRAMS)
 ]
 
 MODULE = 'xpcom'
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
 
 CPP_UNIT_TESTS += [
     'ShowAlignments.cpp',
--- a/xpcom/typelib/xpt/tests/moz.build
+++ b/xpcom/typelib/xpt/tests/moz.build
@@ -1,21 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 MODULE = 'xpcom'
 
-sources = [
+SIMPLE_PROGRAMS = [
     'PrimitiveTest',
     'SimpleTypeLib',
 ]
 
 SOURCES += [
-    '%s.c' % s for s in sources
+    '%s.c' % s for s in SIMPLE_PROGRAMS
 ]
-
-bin_suffix = CONFIG['BIN_SUFFIX']
-SIMPLE_PROGRAMS += [
-    '%s%s' % (s, bin_suffix) for s in sources
-]
--- a/xpcom/windbgdlg/moz.build
+++ b/xpcom/windbgdlg/moz.build
@@ -4,10 +4,10 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SOURCES += [
     'windbgdlg.cpp',
 ]
 
 SIMPLE_PROGRAMS += [
-    "windbgdlg%s" % (CONFIG['BIN_SUFFIX'])
+    'windbgdlg'
 ]