Skip to content

Commit

Permalink
Merge pull request #725 from bittide/rs/vivado-logging
Browse files Browse the repository at this point in the history
Allow setting of the Vivado logging directory
  • Loading branch information
rslawson authored Feb 26, 2025
2 parents f9581fd + 8cfbb1b commit a883e38
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,10 @@ jobs:
target="bitstream"
fi
export VIVADO_HS_LOG_DIR="$(git rev-parse --show-toplevel)/_build/hitl/vivado-gensynth/"
if [[ ! -d "${VIVADO_HS_LOG_DIR} " ]]; then
mkdir -p "${VIVADO_HS_LOG_DIR}"
fi
.github/scripts/with_vivado.sh \
shake ${{ matrix.target.top }}:"${target}"
Expand Down Expand Up @@ -645,6 +649,10 @@ jobs:

- name: Run tests on hardware
run: |
export VIVADO_HS_LOG_DIR="$(git rev-parse --show-toplevel)/_build/hitl/vivado-run/"
if [[ ! -d "${VIVADO_HS_LOG_DIR} " ]]; then
mkdir -p "${VIVADO_HS_LOG_DIR}"
fi
.github/scripts/with_vivado.sh \
shake ${{ matrix.target.top }}:test
Expand Down
11 changes: 9 additions & 2 deletions vivado-hs/src/Vivado/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Data.String.Interpolate (__i)
import Data.Typeable (Typeable)
import GHC.Stack (HasCallStack)
import System.Directory.Extra (removeFile)
import System.Environment (setEnv)
import System.Environment (getEnv, setEnv)
import System.IO (Handle)
import System.Process

Expand Down Expand Up @@ -231,9 +231,16 @@ execPrint_ v cmd = do
-}
with :: (VivadoHandle -> IO a) -> IO a
with f = do
systemTmpDir <- Temp.getCanonicalTemporaryDirectory
systemTmpDirEnv <- getEnv "VIVADO_HS_LOG_DIR"
systemTmpDir <-
if systemTmpDirEnv == ""
then Temp.getCanonicalTemporaryDirectory
else pure systemTmpDirEnv
putStrLn $ "Using tmpdir: " <> systemTmpDir
(logPath, logHandle) <- Temp.openTempFile systemTmpDir "vivado-hs.log"
putStrLn $ "Using log path: " <> logPath
(prettyLogPath, prettyLogHandle) <- Temp.openTempFile systemTmpDir "pretty-vivado-hs.log"
putStrLn $ "Using pretty log path: " <> prettyLogPath

a <-
finally
Expand Down

0 comments on commit a883e38

Please sign in to comment.