Copy packager_test.py to out directory on build

- Disallow packager_test.py to be executed from source directory
- Remove the building of packager target from packager_test.py. User
  need to make sure packager builds successfully before running
  the test.
- Remove build_type parameter which is no longer needed

Change-Id: I479d3c39b8d45730e5388d194069f1320fa5cd75
This commit is contained in:
Kongqun Yang 2016-04-19 17:42:40 -07:00 committed by KongQun Yang
parent ba42fed9e5
commit 797ae3e639
5 changed files with 19 additions and 13 deletions

View File

@ -27,7 +27,7 @@ before_script:
script: script:
- ( find out/${BUILD_TYPE} -name "*_*test" | while read i ; do $i || exit ; done ) - ( find out/${BUILD_TYPE} -name "*_*test" | while read i ; do $i || exit ; done )
- packager/app/test/packager_test.py -v --build_type ${BUILD_TYPE} - out/${BUILD_TYPE}/packager_test.py -v
before_deploy: before_deploy:
- mv out/${BUILD_TYPE}/packager out/${BUILD_TYPE}/packager-${TRAVIS_OS_NAME} - mv out/${BUILD_TYPE}/packager out/${BUILD_TYPE}/packager-${TRAVIS_OS_NAME}

View File

@ -19,12 +19,9 @@ class PackagerApp(object):
"""Main integration class for testing the packager binary.""" """Main integration class for testing the packager binary."""
def __init__(self): def __init__(self):
self.build_dir = os.path.join(test_env.OUT_DIR, self.binary = os.path.join(test_env.SCRIPT_DIR, 'packager')
test_env.options.build_type) assert os.path.exists(self.binary), ('Please run from output directory, '
self.binary = os.path.join(self.build_dir, 'packager') 'e.g. out/Debug/packager_test.py')
def BuildSrc(self):
return subprocess.call(['ninja', '-C', self.build_dir])
def DumpStreamInfo(self, stream): def DumpStreamInfo(self, stream):
input_str = 'input=%s' % stream input_str = 'input=%s' % stream

View File

@ -35,9 +35,6 @@ class PackagerAppTest(unittest.TestCase):
def tearDown(self): def tearDown(self):
shutil.rmtree(self.tmp_dir) shutil.rmtree(self.tmp_dir)
def testBuildingCode(self):
self.assertEqual(0, self.packager.BuildSrc())
def testVersion(self): def testVersion(self):
self.assertRegexpMatches( self.assertRegexpMatches(
self.packager.Version(), '^edash-packager version ' self.packager.Version(), '^edash-packager version '

View File

@ -20,13 +20,12 @@ import sys
# Define static global objects and attributes. # Define static global objects and attributes.
SRC_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../..') SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
OUT_DIR = os.path.join(SRC_DIR, os.getenv('builddir_name', 'out')) SRC_DIR = os.path.join(SCRIPT_DIR, os.pardir, os.pardir)
# Parse arguments and calculate dynamic global objects and attributes. # Parse arguments and calculate dynamic global objects and attributes.
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--build_type', default='Debug')
parser.add_argument('--test_update_golden_files', default=0, type=int) parser.add_argument('--test_update_golden_files', default=0, type=int)
aes = parser.add_argument_group( aes = parser.add_argument_group(

View File

@ -90,6 +90,19 @@
'testing/gtest.gyp:gtest', 'testing/gtest.gyp:gtest',
], ],
}, },
{
'target_name': 'packager_test_py_copy',
'type': 'none',
'copies': [{
'destination': '<(PRODUCT_DIR)',
'files': [
'app/test/packager_app.py',
'app/test/packager_test.py',
'app/test/test_env.py',
],
}],
'dependencies': ['packager'],
},
{ {
'target_name': 'packager_builder_tests', 'target_name': 'packager_builder_tests',
'type': 'none', 'type': 'none',