Skip to content

Commit f02fd93

Browse files
logging build (#666)
* logging build Signed-off-by: habibayassin <[email protected]> Signed-off-by: Vitor Bandeira <[email protected]> Co-authored-by: Vitor Bandeira <[email protected]>
1 parent d7a4b3a commit f02fd93

File tree

6 files changed

+76
-33
lines changed

6 files changed

+76
-33
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
tools
33
!tools/OpenROAD/etc/DependencyInstaller.sh
44

5+
# Build files
6+
build_openroad.log
7+
58
# Test working directories
69
flow/results
710
flow/logs

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# Build working directories
44
tools/install
55

6+
# Build files
7+
build_openroad.log
8+
69
# Test working directories
710
flow/results
811
flow/logs

build_openroad.sh

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ EOF
125125
}
126126

127127
# Parse arguments
128+
__CMD="$0 $@"
128129
while (( "$#" )); do
129130
case "$1" in
130131
-h|--help)
@@ -217,33 +218,35 @@ LSORACLE_ARGS+=" \
217218
-D CMAKE_INSTALL_PREFIX=${INSTALL_PATH}/LSOracle \
218219
"
219220

220-
if [ ! -z "${DOCKER_OVERWIRTE_ARGS+x}" ]; then
221-
echo "[INFO FLW-0015] Overwriting Docker build flags."
222-
DOCKER_ARGS="${DOCKER_USER_ARGS}"
223-
else
224-
DOCKER_ARGS+=" ${DOCKER_USER_ARGS}"
225-
fi
221+
__args_setup() {
222+
if [ ! -z "${DOCKER_OVERWIRTE_ARGS+x}" ]; then
223+
echo "[INFO FLW-0013] Overwriting Docker build flags."
224+
DOCKER_ARGS="${DOCKER_USER_ARGS}"
225+
else
226+
DOCKER_ARGS+=" ${DOCKER_USER_ARGS}"
227+
fi
226228

227-
if [ ! -z "${YOSYS_OVERWIRTE_ARGS+x}" ]; then
228-
echo "[INFO FLW-0013] Overwriting Yosys compilation flags."
229-
YOSYS_ARGS="${YOSYS_USER_ARGS}"
230-
else
231-
YOSYS_ARGS+=" ${YOSYS_USER_ARGS}"
232-
fi
229+
if [ ! -z "${YOSYS_OVERWIRTE_ARGS+x}" ]; then
230+
echo "[INFO FLW-0014] Overwriting Yosys compilation flags."
231+
YOSYS_ARGS="${YOSYS_USER_ARGS}"
232+
else
233+
YOSYS_ARGS+=" ${YOSYS_USER_ARGS}"
234+
fi
233235

234-
if [ ! -z "${OPENROAD_APP_OVERWIRTE_ARGS+x}" ]; then
235-
echo "[INFO FLW-0014] Overwriting OpenROAD app compilation flags."
236-
OPENROAD_APP_ARGS="${OPENROAD_APP_USER_ARGS}"
237-
else
238-
OPENROAD_APP_ARGS+=" ${OPENROAD_APP_USER_ARGS}"
239-
fi
236+
if [ ! -z "${OPENROAD_APP_OVERWIRTE_ARGS+x}" ]; then
237+
echo "[INFO FLW-0015] Overwriting OpenROAD app compilation flags."
238+
OPENROAD_APP_ARGS="${OPENROAD_APP_USER_ARGS}"
239+
else
240+
OPENROAD_APP_ARGS+=" ${OPENROAD_APP_USER_ARGS}"
241+
fi
240242

241-
if [ ! -z "${LSORACLE_OVERWIRTE_ARGS+x}" ]; then
242-
echo "[INFO FLW-0013] Overwriting LSOracle compilation flags."
243-
LSORACLE_ARGS="${LSORACLE_USER_ARGS}"
244-
else
245-
LSORACLE_ARGS+=" ${LSORACLE_USER_ARGS}"
246-
fi
243+
if [ ! -z "${LSORACLE_OVERWIRTE_ARGS+x}" ]; then
244+
echo "[INFO FLW-0016] Overwriting LSOracle compilation flags."
245+
LSORACLE_ARGS="${LSORACLE_USER_ARGS}"
246+
else
247+
LSORACLE_ARGS+=" ${LSORACLE_USER_ARGS}"
248+
fi
249+
}
247250

248251
__docker_build()
249252
{
@@ -358,18 +361,31 @@ __common_setup()
358361
fi
359362
}
360363

361-
__common_setup
364+
__logging()
365+
{
366+
local log_file="build_openroad.log"
367+
echo "[INFO FLW-0027] Saving logs to ${log_file}"
368+
echo "[INFO FLW-0028] $__CMD"
369+
exec > >(tee -i "${log_file}")
370+
exec 2>&1
371+
}
362372

363-
if [ ! -z "${CLEAN_FORCE+x}" ]; then
364-
CLEAN_CMD="-x -d --force"
365-
else
366-
CLEAN_CMD="-x -d --interactive"
367-
fi
368-
if [ ! -z "${CLEAN_BEFORE+x}" ]; then
369-
echo "[INFO FLW-0016] Cleaning up previous binaries and build files."
373+
__cleanup()
374+
{
375+
if [ ! -z "${CLEAN_FORCE+x}" ]; then
376+
CLEAN_CMD="-x -d --force"
377+
else
378+
CLEAN_CMD="-x -d --interactive"
379+
fi
380+
echo "[INFO FLW-0026] Cleaning up previous binaries and build files."
370381
git clean ${CLEAN_CMD} tools
371382
git submodule foreach --recursive git clean ${CLEAN_CMD}
372-
fi
383+
}
384+
385+
__cleanup
386+
__logging
387+
__args_setup
388+
__common_setup
373389

374390
# Choose install method
375391
if [ -z "${LOCAL_BUILD+x}" ] && command -v docker &> /dev/null; then

jenkins/public_nightly.Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ pipeline {
3636
sh "./build_openroad.sh --local --no_init --latest";
3737
stash name: "install", includes: "tools/install/**";
3838
}
39+
post {
40+
always {
41+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
42+
archiveArtifacts artifacts: "build_openroad.log";
43+
}
44+
}
45+
}
3946
}
4047

4148
stage('Tests') {

jenkins/public_tests_all.Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ pipeline {
1414
sh "./build_openroad.sh --local";
1515
stash name: "install", includes: "tools/install/**";
1616
}
17+
post {
18+
always {
19+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
20+
archiveArtifacts artifacts: "build_openroad.log";
21+
}
22+
}
23+
}
1724
}
1825

1926
stage('Tests') {

jenkins/public_tests_small.Jenkinsfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ pipeline {
1414
sh "./build_openroad.sh --local";
1515
stash name: "install", includes: "tools/install/**";
1616
}
17+
post {
18+
always {
19+
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
20+
archiveArtifacts artifacts: "build_openroad.log";
21+
}
22+
}
23+
}
1724
}
1825

1926
stage('Tests') {

0 commit comments

Comments
 (0)