mirror of https://github.com/efabless/caravel.git
Merge pull request #298 from efabless/cocotb-dev
cocotb - update script to store git info in the run git_show.log
This commit is contained in:
commit
9d1e4b35d7
|
@ -11,6 +11,7 @@ from datetime import datetime
|
||||||
import random
|
import random
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import shutil
|
import shutil
|
||||||
|
from subprocess import PIPE, run
|
||||||
|
|
||||||
|
|
||||||
iverilog = True
|
iverilog = True
|
||||||
|
@ -236,6 +237,7 @@ class RunRegression:
|
||||||
type_arg = "RTL"
|
type_arg = "RTL"
|
||||||
self.type_arg = type_arg
|
self.type_arg = type_arg
|
||||||
self.write_command_log()
|
self.write_command_log()
|
||||||
|
self.write_git_log()
|
||||||
with open('tests.json') as f:
|
with open('tests.json') as f:
|
||||||
self.tests_json = json.load(f)
|
self.tests_json = json.load(f)
|
||||||
self.tests_json = self.tests_json["Tests"]
|
self.tests_json = self.tests_json["Tests"]
|
||||||
|
@ -354,6 +356,19 @@ class RunRegression:
|
||||||
f.write(f"{' '.join(sys.argv)}")
|
f.write(f"{' '.join(sys.argv)}")
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
def write_git_log(self):
|
||||||
|
file_name=f"sim/{os.getenv('RUNTAG')}/git_show.log"
|
||||||
|
f = open(file_name, "w")
|
||||||
|
# status, output = commands.getstatusoutput("git show")
|
||||||
|
f.write( f"Repo: {run('basename -s .git `git config --get remote.origin.url`', stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True).stdout}")
|
||||||
|
f.write( f"Branch name: {run('git symbolic-ref --short HEAD', stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True).stdout}")
|
||||||
|
f.write( run('git show --quiet HEAD', stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True).stdout)
|
||||||
|
MCW_ROOT = f"MCW_ROOT"
|
||||||
|
|
||||||
|
f.write( f"\n\nRepo: {run(f'cd {os.getenv(MCW_ROOT)};basename -s .git `git config --get remote.origin.url`', stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True).stdout}")
|
||||||
|
f.write( f"Branch name: {run(f'cd {os.getenv(MCW_ROOT)};git symbolic-ref --short HEAD', stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True).stdout}")
|
||||||
|
f.write( run(f'cd {os.getenv(MCW_ROOT)};git show --quiet HEAD', stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True).stdout)
|
||||||
|
f.close()
|
||||||
class main():
|
class main():
|
||||||
def __init__(self,args) -> None:
|
def __init__(self,args) -> None:
|
||||||
self.regression = args.regression
|
self.regression = args.regression
|
||||||
|
|
Loading…
Reference in New Issue