Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 158b4df6 authored by Yu Liu's avatar Yu Liu Committed by Automerger Merge Worker
Browse files

Merge "Tweak the CUJ scripts to make it work in CI." into main am: 15fb2a41 am: d0273e9c

parents 65a2aa24 d0273e9c
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -130,8 +130,9 @@ def Snapshot(filename):
def Clean():
    """Remove the out directory."""
    def remove_out():
        if os.path.exists("out"):
            shutil.rmtree("out")
        out_dir = utils.get_out_dir()
        if os.path.exists(out_dir):
            shutil.rmtree(out_dir)
    return Change(label="Remove out", change=remove_out, undo=lambda: None)


@@ -270,7 +271,7 @@ class Runner():

    def _run_benchmark(self, lunch, benchmark, iteration):
        """Run a single benchmark."""
        benchmark_log_subdir = self._log_dir(lunch, benchmark, iteration)
        benchmark_log_subdir = self._benchmark_log_dir(lunch, benchmark, iteration)
        benchmark_log_dir = self._options.LogDir().joinpath(benchmark_log_subdir)

        sys.stderr.write(f"STARTING BENCHMARK: {benchmark.id}\n")
@@ -298,7 +299,7 @@ class Runner():
            dist_one = self._options.DistOne()
            if dist_one:
                # If we're disting just one benchmark, save the logs and we can stop here.
                self._dist(dist_one)
                self._dist(utils.get_dist_dir())
            else:
                # Postroll builds
                for i in range(benchmark.preroll):
@@ -315,7 +316,7 @@ class Runner():
        self._write_summary()
        sys.stderr.write(f"FINISHED BENCHMARK: {benchmark.id}\n")

    def _log_dir(self, lunch, benchmark, iteration):
    def _benchmark_log_dir(self, lunch, benchmark, iteration):
        """Construct the log directory fir a benchmark run."""
        path = f"{lunch.Combine()}/{benchmark.id}"
        # Zero pad to the correct length for correct alpha sorting
@@ -355,8 +356,8 @@ class Runner():
        return after_ns - before_ns

    def _dist(self, dist_dir):
        out_dir = pathlib.Path("out")
        dest_dir = pathlib.Path(dist_dir).joinpath("logs")
        out_dir = utils.get_out_dir()
        dest_dir = dist_dir.joinpath("logs")
        os.makedirs(dest_dir, exist_ok=True)
        basenames = [
            "build.trace.gz",
+12 −0
Original line number Diff line number Diff line
@@ -28,3 +28,15 @@ def get_root():
        d = d.parent
        if d == pathlib.Path("/"):
            return None

def get_dist_dir():
    dist_dir = os.getenv("DIST_DIR")
    if dist_dir:
        return pathlib.Path(dist_dir).resolve()
    return get_out_dir().joinpath("dist")

def get_out_dir():
    out_dir = os.getenv("OUT_DIR")
    if not out_dir:
        out_dir = "out"
    return pathlib.Path(out_dir).resolve()