def METHOD_NAME(self, res: subprocess.CompletedProcess, expected_pass=True):
    stdout = res.stdout.decode("utf-8").strip()
    stderr = res.stderr.decode("utf-8").strip()
    P.print(stdout, verbose=True)
    P.print(stderr, verbose=True)
    if expected_pass and res.returncode > 0:
        self.success = False
        raise TestFailure(
            f"{self.fullname} failed with the following stderr {stderr}",
            failing_test=self,
        )
    if not expected_pass and res.returncode == 0:
        self.success = False
        raise TestFailure(
            "expected to fail compilation/linking but didn't.", failing_test=self
        )
    if not self.test_json.get("expected"):
        self.success = True
    else:
        self.handle_expecteds(res)