Write benchmarks to out/before and out/after instead of out/

Change-Id: I681147b25ff0fe5d782664147ebae94f6a6a6964
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/25760
Commit-Queue: Matt Stark <msta@google.com>
Reviewed-by: Takuto Ikuta <tikuta@google.com>
diff --git a/build/gen.py b/build/gen.py
index 80b1c0d..e4e377e 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -472,8 +472,8 @@
     gen_src_dir, gen_out_dir = options.gen_target.split('=', 1)
     ninja.AddExternalGenTarget(
       'gen',
-      pathlib.Path(os.path.expanduser(gen_src_dir)).resolve(),
-      pathlib.Path(gen_out_dir)
+      pathlib.Path(os.path.expandvars(os.path.expanduser(gen_src_dir))).resolve(),
+      pathlib.Path(os.path.expandvars(gen_out_dir))
     )
 
   with open(path, 'w') as f: