Example #1
0
def main():
    """Execute specified indexed project actions."""
    args = parse_args()

    if args.default_timeout:
        common.set_default_execute_timeout(args.default_timeout)

    index = json.loads(open(args.projects).read())
    result = project_future.ProjectListBuilder(
        args.include_repos, args.exclude_repos, args.verbose,
        project_future.ProjectBuilder.factory(
            args.include_versions,
            args.exclude_versions,
            args.verbose,
            project_future.VersionBuilder.factory(
                args.include_actions,
                args.exclude_actions,
                args.verbose,
                project_future.CompatActionBuilder.factory(
                    args.swiftc, args.swift_version, args.swift_branch,
                    args.sandbox_profile_xcodebuild,
                    args.sandbox_profile_package, args.add_swift_flags,
                    args.add_xcodebuild_flags, args.skip_clean,
                    args.build_config, args.strip_resource_phases,
                    args.only_latest_versions),
            ),
        ), index).build()
    common.debug_print(str(result))
    return 0 if result.result in [
        project_future.ResultEnum.PASS, project_future.ResultEnum.XFAIL
    ] else 1
 def build_incremental(self, identifier, commits, stdout=sys.stdout):
     if os.path.exists(self.incr_path):
         shutil.rmtree(self.incr_path)
     os.makedirs(self.incr_path)
     prev = None
     seq = 0
     action_result = ActionResult(Result.PASS, "")
     for sha in commits:
         proj = self.project['path']
         ident = "%s-%03d-%.7s" % (identifier, seq, sha)
         if prev is None:
             common.debug_print("Doing full build #%03d of %s: %.7s" %
                                (seq, proj, sha), stderr=stdout)
             self.checkout_sha(sha, stdout=stdout, stderr=stdout)
             action_result = self.dispatch_or_raise(ident, incremental=False,
                                                    stdout=stdout, stderr=stdout)
             self.save_build_state(seq, 'full', sha, None, stdout=stdout)
         else:
             common.debug_print("Doing incr build #%d of %s: %.7s -> %.7s" %
                                (seq, proj, prev, sha), stderr=stdout)
             common.git_checkout(sha, self.proj_path, stdout=stdout, stderr=stdout)
             common.git_submodule_update(self.proj_path, stdout=stdout, stderr=stdout)
             action_result = self.dispatch_or_raise(ident, incremental=True,
                                                    stdout=stdout, stderr=stdout)
             self.save_build_state(seq, 'incr', sha, stdout=stdout)
         prev = sha
         seq += 1
     return action_result
Example #3
0
def main():
    """Execute specified indexed project actions."""
    args = parse_args()
    index = json.loads(open(args.projects).read())
    result = project.ProjectListBuilder(
        args.include_repos,
        args.exclude_repos,
        args.verbose,
        project.ProjectBuilder.factory(
            args.include_actions,
            args.exclude_actions,
            args.verbose,
            project.IncrementalActionBuilder.factory(
                args.swiftc,
                args.swift_version,
                args.swift_branch,
                args.job_type,
                args.sandbox_profile_xcodebuild,
                args.sandbox_profile_package,
                args.add_swift_flags,
                args.build_config,
                args.strip_resource_phases
            ),
        ),
        index
    ).build()
    common.debug_print(str(result))
    return 0 if result.result in [project.ResultEnum.PASS,
                                  project.ResultEnum.XFAIL] else 1
 def succeeded(self, identifier):
     compatible_swift = identifier
     compatible_swift_message = (
         compatible_swift + '=' +
         self.project['compatibility'][compatible_swift]['commit'])
     bug_identifier = None
     if 'xfail' in self.action:
         bug_identifier = is_xfailed(self.action['xfail'], compatible_swift,
                                     self.current_platform,
                                     self.swift_branch)
     if bug_identifier:
         error_str = 'UPASS: {bug}, {project}, {compatibility}, {action_target}'.format(
             bug=bug_identifier,
             project=self.project['path'],
             compatibility=compatible_swift,
             action_target=dict_get(self.action,
                                    'scheme',
                                    'target',
                                    default="Swift Package"))
         if 'destination' in self.action:
             error_str += ', ' + self.action['destination']
         result = ActionResult(Result.UPASS, error_str)
     else:
         error_str = 'PASS: {project}, {compatibility}, {action_target}'.format(
             project=self.project['path'],
             compatibility=compatible_swift,
             action_target=dict_get(self.action,
                                    'scheme',
                                    'target',
                                    default="Swift Package"))
         if 'destination' in self.action:
             error_str += ', ' + self.action['destination']
         result = ActionResult(Result.PASS, error_str)
     common.debug_print(error_str)
     return result
Example #5
0
def run_server(debug, client_socket, command):								
	common.debug_print(debug, 'Command: ' + command)														
	ct = common.CommandThread(command)
	ct.start()																					
	time.sleep(server_warmup)	# Not really a warmup (dummy run done with client); more like setup (ensure server socket is open etc.)																					
	client_socket.send('1') # Notify client script that the Server is ready													
	ct.join()																						
	time.sleep(cool_down)   # Make sure everything has been shut down and the server port has become free again 
 def save_build_state(self, seq, flav, sha, stdout=sys.stdout):
     src = self.curr_build_state_path()
     dst = self.saved_build_state_path(seq, flav, sha)
     proj = self.project['path']
     common.debug_print("Saving %s state #%d of %s to %s" %
                        (flav, seq, proj, dst), stderr=stdout)
     if os.path.exists(dst):
         shutil.rmtree(dst)
     shutil.copytree(src, dst, symlinks=True)
 def failed(self, identifier, error):
     if 'xfail' in self.action:
         error_str = 'XFAIL: %s: %s' % (identifier, error)
         result = ActionResult(Result.XFAIL, error_str)
     else:
         error_str = 'FAIL: %s: %s' % (identifier, error)
         result = ActionResult(Result.FAIL, error_str)
     common.debug_print(error_str)
     return result
 def succeeded(self, identifier):
     if 'xfail' in self.action:
         error_str = 'UPASS: %s: %s' % (identifier, self.action)
         result = ActionResult(Result.UPASS, error_str)
     else:
         error_str = 'PASS: %s: %s' % (identifier, self.action)
         result = ActionResult(Result.PASS, error_str)
     common.debug_print(error_str)
     return result
def main():
    """Execute specified indexed project actions."""
    args = parse_args()

    if args.default_timeout:
        common.set_default_execute_timeout(args.default_timeout)

    # DISABLED DUE TO: rdar://59302454.
    # To track removing this line: rdar://59302467.
    xcodebuild_flags = args.add_xcodebuild_flags
    xcodebuild_flags += (' ' if xcodebuild_flags else '') + 'DEBUG_INFORMATION_FORMAT=dwarf'

    # FIXME: using swift-driver in the source compatibility test suite
    # is blocked by rdar://75486433
    swift_flags = args.add_swift_flags
    swift_flags += (' ' if swift_flags else '') + '-disallow-use-new-driver'

    index = json.loads(open(args.projects).read())
    result = project_future.ProjectListBuilder(
        args.include_repos,
        args.exclude_repos,
        args.verbose,
        project_future.ProjectBuilder.factory(
            args.include_versions,
            args.exclude_versions,
            args.verbose,
            project_future.VersionBuilder.factory(
                args.include_actions,
                args.exclude_actions,
                args.verbose,
                project_future.CompatActionBuilder.factory(
                    args.swiftc,
                    args.swift_version,
                    args.swift_branch,
                    args.sandbox_profile_xcodebuild,
                    args.sandbox_profile_package,
                    swift_flags,
                    xcodebuild_flags,
                    args.skip_clean,
                    args.build_config,
                    args.strip_resource_phases,
                    args.only_latest_versions,
                    args.project_cache_path
                ),
            ),
        ),
        index
    ).build()
    common.debug_print(str(result))
    return 0 if result.result in [project_future.ResultEnum.PASS,
                                  project_future.ResultEnum.XFAIL] else 1
 def check_full_vs_incr(self, seq, sha, stdout=sys.stdout):
     full = self.saved_build_state_path(seq, 'full', sha)
     incr = self.saved_build_state_path(seq, 'incr', sha)
     common.debug_print("Comparing dirs %s vs. %s" %
                        (os.path.relpath(full), os.path.basename(incr)),
                        stderr=stdout)
     d = filecmp.dircmp(full, incr, self.ignored_differences())
     if not have_same_trees(full, incr, d):
         message = ("Dirs differ: %s vs. %s" %
                    (os.path.relpath(full), os.path.basename(incr)))
         if self.expect_determinism():
             raise EarlyExit(ActionResult(Result.FAIL, message))
         else:
             common.debug_print(message, stderr=stdout)
Example #11
0
def main():
    """Execute specified indexed project actions."""
    args = parse_args()

    if args.default_timeout:
        common.set_default_execute_timeout(args.default_timeout)

    # DISABLED DUE TO: rdar://59302454.
    # To track removing this line: rdar://59302467.
    xcodebuild_flags = args.add_xcodebuild_flags
    xcodebuild_flags += (' ' if xcodebuild_flags else
                         '') + 'DEBUG_INFORMATION_FORMAT=dwarf'

    # Use clang for building xcode projects.
    if args.clang:
        xcodebuild_flags += ' CC=%s' % args.clang

    swift_flags = args.add_swift_flags

    time_reporter = None
    if args.report_time_path:
        time_reporter = project_future.TimeReporter(args.report_time_path)

    index = json.loads(open(args.projects).read())
    result = project_future.ProjectListBuilder(
        args.include_repos, args.exclude_repos, args.verbose,
        project_future.ProjectBuilder.factory(
            args.include_versions,
            args.exclude_versions,
            args.verbose,
            project_future.VersionBuilder.factory(
                args.include_actions,
                args.exclude_actions,
                args.verbose,
                project_future.CompatActionBuilder.factory(
                    args.swiftc, args.swift_version, args.swift_branch,
                    args.job_type, args.sandbox_profile_xcodebuild,
                    args.sandbox_profile_package, swift_flags,
                    xcodebuild_flags, args.skip_clean, args.build_config,
                    args.strip_resource_phases, args.only_latest_versions,
                    args.project_cache_path, time_reporter,
                    args.override_swift_exec),
            ),
        ), index).build()
    common.debug_print(str(result))
    return 0 if result.result in [
        project_future.ResultEnum.PASS, project_future.ResultEnum.XFAIL
    ] else 1
 def build(self, stdout=sys.stdout):
     scheme_target = dict_get(self.action, 'scheme', 'target', default=False)
     identifier = ': '.join(
         [self.action['action'], self.project['path']] +
         ([scheme_target] if scheme_target else [])
     )
     for compatible_swift in self.project['compatibility'].keys()[:1]:
         if len(self.project['compatibility'][compatible_swift]['commit']) != 40:
             common.debug_print("ERROR: Commits must be 40 character SHA hashes")
             exit(1)
         self.checkout_sha(
             self.project['compatibility'][compatible_swift]['commit'],
             stdout=stdout, stderr=stdout
         )
         action_result = self.dispatch(compatible_swift,
                                       stdout=stdout, stderr=stdout)
         if action_result.result not in [ResultEnum.PASS,
                                         ResultEnum.XFAIL]:
             return action_result
     return action_result
Example #13
0
def parse(file, devices, messages):
    with open(file, 'r') as fd:
        for line in fd:
            for index, regex in enumerate(regexs.regexs):
                keyword, search, replace = regex
                if re.search(keyword, line):
                    s = re.sub(search, replace, line)
                    if s:
                        common.debug_print(s, index, -1)
                        if index == 0:
                            l = s.split('\t')
                            if (len(l) > 4):
                                devices[common.delete_prefix(l[0],
                                                             'ACT-')] = l[4]
                            # devices[l[4]] = l[4]
                        # get device name or IP
                        l = s.split('\t', 1)
                        common.debug_print(l, index, -1)
                        if (len(l) > 1):
                            name = common.delete_prefix(l[0], 'ACT-')
                            messages[name].append(l[1])
def have_same_trees(full, incr, d):
    ok = True
    for f in d.left_only:
        if ignore_missing(f):
            continue
        ok = False
        common.debug_print("Missing 'incr' file: %s" %
                           os.path.relpath(os.path.join(d.left, f), full))

    for f in d.right_only:
        if ignore_missing(f):
            continue
        ok = False
        common.debug_print("Missing 'full' file: %s" %
                           os.path.relpath(os.path.join(d.right, f), incr))

    for f in d.diff_files:
        if ignore_diff(f):
            continue
        ok = False
        common.debug_print("File difference: %s" %
                           os.path.relpath(os.path.join(d.left, f), full))

    for sub in d.subdirs.values():
        ok = have_same_trees(full, incr, sub) and ok
    return ok
Example #15
0
 def failed(self, identifier, error):
     compatible_swift = identifier
     compatible_swift_message = (
         compatible_swift + '=' +
         self.project['compatibility'][compatible_swift]['commit']
     )
     bug_identifier = None
     build_config = self.build_config if self.build_config else self.action.get('configuration', None)
     if 'xfail' in self.action:
         bug_identifier = is_xfailed(self.action['xfail'],
                                     compatible_swift,
                                     self.current_platform,
                                     self.swift_branch,
                                     build_config)
     if bug_identifier:
         error_str = 'XFAIL: {bug}, {project}, {compatibility}, {action_target}'.format(
                         bug=bug_identifier,
                         project=self.project['path'],
                         compatibility=compatible_swift,
                         action_target = dict_get(self.action, 'scheme', 'target', default="Swift Package")
                     )
         if 'destination' in self.action:
             error_str += ', ' + self.action['destination']
         result = ActionResult(Result.XFAIL, error_str)
     else:
         error_str = 'FAIL: {project}, {compatibility}, {action_target}'.format(
                         project=self.project['path'],
                         compatibility=compatible_swift,
                         action_target = dict_get(self.action, 'scheme', 'target', default="Swift Package")
                     )
         if 'destination' in self.action:
             error_str += ', ' + self.action['destination']
         error_str += ', ' + str(error)
         result = ActionResult(Result.FAIL, error_str)
     common.debug_print(error_str)
     return result
Example #16
0
def run_client(debug, s, run_command):								
	s.recv(1024) # Wait for the Server to signal that it is ready				
	common.debug_print(debug, 'Command: ' + run_command)	
	os.system(run_command)								
	common.debug_print(debug, 'Command: ' + kill_command)	
	os.system(kill_command)
Example #17
0
def main():
    args = parse_args()
    common.set_swift_branch(args.swift_branch)
    common.debug_print('** REPRODUCE **')

    skip_swift_build = args.skip_swift_build
    if args.swiftc:
        skip_swift_build = True

    if not skip_swift_build:
        # Only prompt for deletion if directories exist
        have_existing_dirs = False
        if os.path.exists('./build') or os.path.exists('./swift') or \
           os.path.exists('./cmark'):
            have_existing_dirs = True

        # Optionally clean up previous source/build directories
        should_cleanup = False
        should_clone = False
        if have_existing_dirs and not args.skip_cleanup:
            if not args.no_prompt:
                response = raw_input(
                    'Delete all build and source directories '
                    'in current working directory? (y/n): ').strip().lower()
                if response == 'y':
                    should_cleanup = True
            else:
                should_cleanup = True
            if should_cleanup:
                common.check_execute(
                    ['./cleanup', args.swift_branch, '--skip-ci-steps'])
                should_clone = True
        else:
            should_clone = True

        # Build and install Swift and associated projects
        run_command = [
            './run', args.swift_branch, '--skip-ci-steps', '--skip-runner'
        ]
        if not should_clone:
            run_command += ['--skip-clone']
        if args.assertions:
            run_command += ['--assertions']
        common.check_execute(run_command, timeout=3600)

    # Build specified indexed project. Otherwise, build all indexed projects
    runner_command = [
        './runner.py',
        '--projects',
        'projects.json',
        '--swift-branch',
        args.swift_branch,
        '--swift-version',
        '3',
        '--include-actions',
        'action.startswith("Build")',
    ]
    if args.swiftc:
        runner_command += ['--swiftc', args.swiftc]
    else:
        runner_command += [
            '--swiftc', './build/compat_macos/install/toolchain/usr/bin/swiftc'
        ]
    if args.add_swift_flags:
        runner_command += ['--add-swift-flags=%s' % args.add_swift_flags]
    if args.project_path:
        runner_command += [
            '--include-repos',
            'path == "%s"' % args.project_path
        ]
    if args.sandbox_profile_xcodebuild:
        runner_command += [
            '--sandbox-profile-xcodebuild', args.sandbox_profile_xcodebuild
        ]
    if args.sandbox_profile_package:
        runner_command += [
            '--sandbox-profile-package', args.sandbox_profile_package
        ]
    common.check_execute(runner_command)

    return 0
Example #18
0
def run_command(debug, command):
	common.debug_print(debug, 'Command: ' + command)	
	os.system(command)
Example #19
0
	os.system(kill_command)


##
# Main. (This script needs to be refactored into main plus aux. functions.)
##
common.print_and_flush('Global: renv=' + renv + ', timer=' + timer + ', versions=' + str(versions) + ', message_sizes=' + str(message_sizes) + ', session_lengths=' + str(session_lengths) + ', repeats=' + str(repeats) + ', iters=' + iters)

server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if env == 'LOCALHOST':
	hostname = 'localhost'
else:
	hostname = socket.gethostname()
server_socket.bind((hostname, cport))
server_socket.listen(5) # 5 seems to be a kind of default.
common.debug_print(debug, 'Listening on port: ' + str(cport))	
(s, address) = server_socket.accept()

for v in versions:
	transport = ''
	if v == 'RMI':
		client = 'rmi.RMIClient'
	elif v.startswith('SJ'):		
		transport = v[2]
		v = v[0:2]		
		client = 'sj.SJClient'
	elif v == 'SOCKm':
		client = 'socket.ManualClient'
	elif v == 'SOCKs':
		client = 'socket.StreamClient'
	else: