def runTest(self): env = os.environ.copy() env["WATCHMAN_SOCK"] = WatchmanInstance.getSharedInstance( ).getSockPath() env["TMPDIR"] = self.tempdir # build the node module with npm node_dir = os.path.join(env["TMPDIR"], "fb-watchman") shutil.copytree(os.path.join(WATCHMAN_SRC_DIR, "node"), node_dir) subprocess.check_call(["npm", "install"], cwd=node_dir) env["TMP"] = env["TMPDIR"] env["TEMP"] = env["TMPDIR"] env["IN_PYTHON_HARNESS"] = "1" env["NODE_PATH"] = "%s:%s" % (env["TMPDIR"], env.get("NODE_PATH", "")) proc = subprocess.Popen( self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail("Interrupted by SIGINT") return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout.decode("utf-8"), stderr.decode("utf-8"))) return self.assertTrue(True, self.getCommandArgs())
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance( ).getSockPath() dotted = os.path.normpath(self.id()).replace(os.sep, '.').replace( 'tests.integration.', '').replace('.php', '') env['TMPDIR'] = os.path.join(tempfile.tempdir, dotted) os.mkdir(env['TMPDIR']) # build the node module with npm node_dir = os.path.join(env['TMPDIR'], 'fb-watchman') shutil.copytree('node', node_dir) subprocess.check_call(['npm', 'install'], cwd=node_dir) env['TMP'] = env['TMPDIR'] env['TEMP'] = env['TMPDIR'] env['IN_PYTHON_HARNESS'] = '1' env['NODE_PATH'] = '%s:%s' % (env['TMPDIR'], env.get('NODE_PATH', '')) proc = subprocess.Popen(self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout.decode('utf-8'), stderr.decode('utf-8'))) return self.assertTrue(True, self.jsfile)
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance( ).getSockPath() dotted = os.path.normpath(self.id()).replace(os.sep, '.').replace( 'tests.integration.', '').replace('.php', '') env['TMPDIR'] = os.path.join(tempfile.tempdir, dotted) os.mkdir(env['TMPDIR']) env['TMP'] = env['TMPDIR'] env['TEMP'] = env['TMPDIR'] env['IN_PYTHON_HARNESS'] = '1' proc = subprocess.Popen(self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout, stderr)) return self.assertTrue(True, self.jsfile)
def runTest(self): env = os.environ.copy() env["WATCHMAN_SOCK"] = WatchmanInstance.getSharedInstance().getSockPath() env["TMPDIR"] = self.tempdir # build the node module with npm node_dir = os.path.join(env["TMPDIR"], "fb-watchman") shutil.copytree(os.path.join(WATCHMAN_SRC_DIR, "node"), node_dir) subprocess.check_call(["npm", "install"], cwd=node_dir) env["TMP"] = env["TMPDIR"] env["TEMP"] = env["TMPDIR"] env["IN_PYTHON_HARNESS"] = "1" env["NODE_PATH"] = "%s:%s" % (env["TMPDIR"], env.get("NODE_PATH", "")) proc = subprocess.Popen( self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail("Interrupted by SIGINT") return if status != 0: self.fail( "Exit status %d\n%s\n%s\n" % (status, stdout.decode("utf-8"), stderr.decode("utf-8")) ) return self.assertTrue(True, self.getCommandArgs())
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance().getSockPath() dotted = os.path.normpath(self.id()).replace(os.sep, '.').replace( 'tests.integration.', '').replace('.php', '') env['TMPDIR'] = os.path.join(tempfile.tempdir, dotted) os.mkdir(env['TMPDIR']) env['TMP'] = env['TMPDIR'] env['TEMP'] = env['TMPDIR'] env['IN_PYTHON_HARNESS'] = '1' proc = subprocess.Popen( self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout.decode('utf-8'), stderr.decode('utf-8'))) return self.assertTrue(True, self.jsfile)
def test_cppclient(self): env = os.environ.copy() env["WATCHMAN_SOCK"] = (WatchmanInstance.getSharedInstance(). getSockPath().legacy_sockpath()) proc = subprocess.Popen( TEST_BINARY, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=self.tmpDir, ) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail("Interrupted by SIGINT") return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout.decode("utf-8"), stderr.decode("utf-8"))) return self.assertTrue(True, TEST_BINARY)
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance().getSockPath() dotted = os.path.normpath(self.id()).replace(os.sep, '.').replace( 'tests.integration.', '').replace('.php', '') env['TMPDIR'] = os.path.join(TempDir.get_temp_dir().get_dir(), dotted) os.mkdir(env['TMPDIR']) # build the node module with npm node_dir = os.path.join(env['TMPDIR'], 'fb-watchman') shutil.copytree(os.path.join(WATCHMAN_SRC_DIR, 'node'), node_dir) subprocess.check_call(['npm', 'install'], cwd=node_dir) env['TMP'] = env['TMPDIR'] env['TEMP'] = env['TMPDIR'] env['IN_PYTHON_HARNESS'] = '1' env['NODE_PATH'] = '%s:%s' % (env['TMPDIR'], env.get('NODE_PATH', '')) proc = subprocess.Popen( self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout.decode('utf-8'), stderr.decode('utf-8'))) return self.assertTrue(True, self.getCommandArgs())
def runTest(self): env = os.environ.copy() env["WATCHMAN_SOCK"] = ( WatchmanInstance.getSharedInstance().getSockPath().legacy_sockpath() ) env["TMPDIR"] = self.tempdir offline_mirror = env.get("YARN_OFFLINE_MIRROR_PATH_POINTER", None) if offline_mirror: with open(offline_mirror, "r") as f: mirror = f.read().strip() env["YARN_YARN_OFFLINE_MIRROR"] = mirror offline = "YARN_YARN_OFFLINE_MIRROR" in env # build the node module with yarn node_dir = os.path.join(env["TMPDIR"], "fb-watchman") shutil.copytree(os.path.join(WATCHMAN_SRC_DIR, "node"), node_dir) install_args = [yarn_bin, "install"] if offline: install_args.append("--offline") bser_dir = os.path.join(node_dir, "bser") subprocess.check_call(install_args, cwd=bser_dir, env=env) env["TMP"] = env["TMPDIR"] env["TEMP"] = env["TMPDIR"] env["IN_PYTHON_HARNESS"] = "1" env["NODE_PATH"] = "%s:%s" % (node_dir, env["TMPDIR"]) proc = subprocess.Popen( self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail("Interrupted by SIGINT") return if status != 0: self.fail( "Exit status %d\n%s\n%s\n" % (status, stdout.decode("utf-8"), stderr.decode("utf-8")) ) return self.assertTrue(True, self.getCommandArgs())
def test_cppclient(self): env = os.environ.copy() env["WATCHMAN_SOCK"] = WatchmanInstance.getSharedInstance().getSockPath() proc = subprocess.Popen( TEST_BINARY, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail("Interrupted by SIGINT") return if status != 0: self.fail( "Exit status %d\n%s\n%s\n" % (status, stdout.decode("utf-8"), stderr.decode("utf-8")) ) return self.assertTrue(True, TEST_BINARY)
def interrupt_handler(signo, frame): Interrupt.setInterrupted()
def interrupt_handler(signo, frame): Interrupt.setInterrupted()
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance( ).getSockPath() dotted = os.path.normpath(self.id()).replace(os.sep, '.').replace( 'tests.integration.', '').replace('.php', '') env['TMPDIR'] = os.path.join(tempfile.tempdir, dotted) if os.name != 'nt' and len(env['TMPDIR']) > 94: self.fail('temp dir name %s is too long for unix domain sockets' % env['TMPDIR']) os.mkdir(env['TMPDIR']) env['TMP'] = env['TMPDIR'] env['TEMP'] = env['TMPDIR'] env['IN_PYTHON_HARNESS'] = '1' proc = subprocess.Popen(self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout, stderr)) return res_pat = re.compile('^(not )?ok (\d+) (.*)$') diag_pat = re.compile('^# (.*)$') plan_pat = re.compile('^1\.\.(\d+)$') # Now parse the TAP output lines = stdout.replace('\r\n', '\n').split('\n') last_test = 0 diags = None plan = None for line in lines: res = plan_pat.match(line) if res: plan = int(res.group(1)) continue res = res_pat.match(line) if res: this_test = int(res.group(2)) if this_test != last_test + 1: print(stdout, stderr) self.fail('Expected test number %d, got %d' % (last_test + 1, this_test)) last_test = this_test if res.group(1) == 'not ': # Failed msg = line if diags is not None: msg = msg + '\n' + '\n'.join(diags) self.fail(msg) failed diags = None continue res = diag_pat.match(line) if res: if diags is None: diags = [] diags.append(res.group(1)) continue if line != '': print('Invalid tap output from %s: %s' % (self.id(), line)) if plan is None: self.fail('no plan was observed') else: self.assertEqual( last_test, plan, '%s planned %d but executed %s tests' % (self.id(), plan, last_test))
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance().getSockPath() def clean_file_name(name): name = name.replace(os.sep, '') name = name.replace('tests.integration', '') name = name.replace('.php', '') name = name.replace('_php', '') name = name.replace('.runTest', '') return name dotted = clean_file_name(os.path.normpath(self.id())) env['TMPDIR'] = os.path.join(TempDir.get_temp_dir().get_dir(), dotted) if os.name != 'nt' and len(env['TMPDIR']) > 94: self.fail('temp dir name %s is too long for unix domain sockets' % env['TMPDIR']) os.mkdir(env['TMPDIR']) env['TMP'] = env['TMPDIR'] env['TEMP'] = env['TMPDIR'] env['IN_PYTHON_HARNESS'] = '1' env['WATCHMAN_PYTHON_BINARY'] = sys.executable proc = subprocess.Popen( self.getCommandArgs(), cwd=env.get('WATCHMAN_SRC_DIR', os.getcwd()), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout, stderr)) return res_pat = re.compile(b'^(not )?ok (\d+) (.*)$') diag_pat = re.compile(b'^# (.*)$') plan_pat = re.compile(b'^1\.\.(\d+)$') # Now parse the TAP output lines = stdout.replace(b'\r\n', b'\n').split(b'\n') last_test = 0 diags = None plan = None for line in lines: res = plan_pat.match(line) if res: plan = int(res.group(1)) continue res = res_pat.match(line) if res: this_test = int(res.group(2)) if this_test != last_test + 1: print(stdout, stderr) self.fail('Expected test number %d, got %d' % ( last_test + 1, this_test)) last_test = this_test if res.group(1) == b'not ': # Failed msg = line if diags is not None: msg = msg + b'\n' + b'\n'.join(diags) self.fail(msg.decode('utf-8')) failed diags = None continue res = diag_pat.match(line) if res: if diags is None: diags = [] diags.append(res.group(1)) continue if line != b'': print('Invalid tap output from %s: %s' % (self.id(), line)) if plan is None: self.fail('no plan was observed') else: self.assertEqual(last_test, plan, '%s planned %d but executed %s tests' % ( self.id(), plan, last_test))
def runTest(self): env = os.environ.copy() env['WATCHMAN_SOCK'] = WatchmanInstance.getSharedInstance().getSockPath() proc = subprocess.Popen( self.getCommandArgs(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail('Interrupted by SIGINT') return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout, stderr)) return res_pat = re.compile('^(not )?ok (\d+) (.*)$') diag_pat = re.compile('^# (.*)$') # Now parse the TAP output lines = stdout.split('\n') # first line is the plan try: plan = int(lines.pop(0).split('..')[1]) except Exception as e: self.fail(stdout + '\n' + stderr) return last_test = 0 diags = None for line in lines: res = res_pat.match(line) if res: this_test = int(res.group(2)) if this_test != last_test + 1: print(stdout, stderr) self.fail('Expected test number %d, got %d' % ( last_test + 1, this_test)) last_test = this_test if res.group(1) == 'not ': # Failed msg = line if diags is not None: msg = msg + '\n'.join(diags) self.fail(msg) failed diags = None continue res = diag_pat.match(line) if res: if diags is None: diags = [] diags.append(res.group(1)) continue if line != '': print('Invalid tap output from %s: %s' % (self.id(), line)) self.assertEqual(last_test, plan, '%s planned %d but executed %d tests' % ( self.id(), plan, last_test))
def runTest(self): env = os.environ.copy() env["WATCHMAN_SOCK"] = WatchmanInstance.getSharedInstance().getSockPath() dotted = os.path.normpath(self.id()).replace(os.sep, ".").replace("tests.integration.", "").replace(".php", "") env["TMPDIR"] = os.path.join(tempfile.tempdir, dotted) if os.name != "nt" and len(env["TMPDIR"]) > 94: self.fail("temp dir name %s is too long for unix domain sockets" % env["TMPDIR"]) os.mkdir(env["TMPDIR"]) env["IN_PYTHON_HARNESS"] = "1" proc = subprocess.Popen(self.getCommandArgs(), env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = proc.communicate() status = proc.poll() if status == -signal.SIGINT: Interrupt.setInterrupted() self.fail("Interrupted by SIGINT") return if status != 0: self.fail("Exit status %d\n%s\n%s\n" % (status, stdout, stderr)) return res_pat = re.compile("^(not )?ok (\d+) (.*)$") diag_pat = re.compile("^# (.*)$") plan_pat = re.compile("^1\.\.(\d+)$") # Now parse the TAP output lines = stdout.split("\n") last_test = 0 diags = None plan = None for line in lines: res = plan_pat.match(line) if res: plan = int(res.group(1)) continue res = res_pat.match(line) if res: this_test = int(res.group(2)) if this_test != last_test + 1: print(stdout, stderr) self.fail("Expected test number %d, got %d" % (last_test + 1, this_test)) last_test = this_test if res.group(1) == "not ": # Failed msg = line if diags is not None: msg = msg + "\n".join(diags) self.fail(msg) failed diags = None continue res = diag_pat.match(line) if res: if diags is None: diags = [] diags.append(res.group(1)) continue if line != "": print("Invalid tap output from %s: %s" % (self.id(), line)) self.assertEqual(last_test, plan, "%s planned %d but executed %s tests" % (self.id(), plan, last_test))