From 0addf4a2979c8d3430963409bf7500c7d7b2ece6 Mon Sep 17 00:00:00 2001 From: bracker Date: Fri, 18 Jun 2021 20:40:19 -0500 Subject: [PATCH] script support for copying large files from tera --- .gitignore | 3 +- .../linux-testvectors/tvCopierTemplate.py | 59 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 wally-pipelined/linux-testgen/linux-testvectors/tvCopierTemplate.py diff --git a/.gitignore b/.gitignore index 7f65a18a..55bd2cc9 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ wlft* testsBP/*/*/*.elf* testsBP/*/OBJ/* testsBP/*/*.a - +wally-pipelined/linux-testgen/linux-testvectors/* +!wally-pipelined/linux-testgen/linux-testvectors/tvCopierTemplate.py diff --git a/wally-pipelined/linux-testgen/linux-testvectors/tvCopierTemplate.py b/wally-pipelined/linux-testgen/linux-testvectors/tvCopierTemplate.py new file mode 100755 index 00000000..054b325a --- /dev/null +++ b/wally-pipelined/linux-testgen/linux-testvectors/tvCopierTemplate.py @@ -0,0 +1,59 @@ +#!/usr/bin/python3 +# Copies Linux testvector files from Tera to ./ (which ought to be /riscv-wally/wally-pipelined/linux-testgen/linux-testvectors/) +import os +from datetime import datetime + +tera = '@tera.eng.hmc.edu' +print("SORRY") +print("This script will fail because you have not set the \'tera\' var to your username") +print("Please make a copy called tvCopier.py") +exit() + +logFile = open('tvCopier.log', 'w') +def pyTee(line): + global logFile + print(line) + logFile.write(line+"\n") + +pyTee('Copying tvDateReporter.py from Tera') +os.system('scp '+tera+':/courses/e190ax/buildroot_boot/tvDateReporter.py ./') +pyTee('Running tvDateReporter.py Locally') +os.system('./tvDateReporter.py && mv tvDates.txt tvDatesLocal.txt') +pyTee('Running tvDateReporter.py on Tera') +os.system('ssh '+tera+' \"cd /courses/e190ax/buildroot_boot && ./tvDateReporter.py\"') +pyTee('Copying tvDates.txt from Tera') +os.system('scp '+tera+':/courses/e190ax/buildroot_boot/tvDates.txt ./') + +copyList = [] + +pyTee('_____________________________________________________________________') +pyTee('| File Name | Local_Date | Tera_Date | Update? |') +with open('tvDatesLocal.txt') as tvDatesLocal, open('tvDates.txt') as tvDatesTera_: + for tvDateLocal, tvDateTera_ in zip(tvDatesLocal,tvDatesTera_): + outString = '| ' + + tvDateLocal = tvDateLocal.strip('\n').split(' ') + tvDateTera_ = tvDateTera_.strip('\n').split(' ') + + tvFile = tvDateLocal[0] + outString += '{:<24}'.format(tvFile) + outString += '| '+tvDateLocal[1]+' | '+tvDateTera_[1] + + tvDateLocal = tvDateLocal[1].split('-') + tvDateTera_ = tvDateTera_[1].split('-') + + tvDateLocal = datetime(int(tvDateLocal[0]),int(tvDateLocal[1]),int(tvDateLocal[2])) + tvDateTera_ = datetime(int(tvDateTera_[0]),int(tvDateTera_[1]),int(tvDateTera_[2])) + + update = tvDateTera_ >= tvDateLocal + outString += ' | '+('yes' if update else 'no ') + ' |' + pyTee(outString) + if update: + copyList.append(tvFile) +pyTee('_____________________________________________________________________') + +for tvFile in copyList: + pyTee('Copying '+tvFile+' from Tera') + os.system('scp '+tera+':/courses/e190ax/buildroot_boot/'+tvFile+' ./') +pyTee('Done!') +logFile.close()