Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnbastiaan committed Mar 29, 2024
1 parent a6fed84 commit 2cec213
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ FROM builder AS run
LABEL vendor="QBayLogic B.V." maintainer="[email protected]"
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 PATH="$PATH:/opt/bin:/root/.ghcup/bin"

ARG DEPS_RUNTIME="gnupg pkg-config openjdk-8-jdk gdb picocom libtinfo5 libtinfo-dev build-essential curl libc6-dev libgmp10-dev python3 ccache libftdi1 libhidapi-hidraw0 libusb-1.0-0 libyaml-0-2"
ARG DEPS_RUNTIME="gnupg pkg-config openjdk-8-jdk gdb-multiarch picocom libtinfo5 libtinfo-dev build-essential curl libc6-dev libgmp10-dev python3 ccache libftdi1 libhidapi-hidraw0 libusb-1.0-0 libyaml-0-2"
RUN apt-get update \
&& apt-get install -y --no-install-recommends $DEPS_RUNTIME \
&& echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list \
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,6 @@ jobs:
run: |
ln -s /opt/bin/openocd /opt/bin/openocd-vexriscv
- name: Install dependencies
run: |
apt-get update
apt-get remove gdb -y
apt get install -y gdb-multiarch
apt-get install -y libftdi1 libhidapi-hidraw0 libusb-1.0-0 libyaml-0-2
- name: Run `clash-vexriscv` unittests
run: |
cabal run clash-vexriscv:unittests
Expand Down
13 changes: 12 additions & 1 deletion clash-vexriscv-sim/tests/Tests/Jtag.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ module Tests.Jtag where

import Prelude

import Control.Applicative ((<|>))
import Control.Monad.Extra (ifM)
import Data.List.Extra (trim)
import Data.Maybe (fromJust)
import System.Directory (findExecutable)
import System.Exit
import System.IO
import System.Process
Expand Down Expand Up @@ -38,6 +40,14 @@ getOpenOcdCfgPath = getDataFileName "data/vexriscv_sim.cfg"
getGdbCmdPath :: IO FilePath
getGdbCmdPath = getDataFileName "data/vexriscv_gdb.cfg"

getGdb :: HasCallStack => IO String
getGdb = do
gdbMultiArch <- findExecutable "gdb-multiarch"
gdb <- findExecutable "gdb"
case gdbMultiArch <|> gdb of
Nothing -> fail "Neither gdb-multiarch nor gdb found in PATH"
Just x -> pure x

expectLine :: Handle -> String -> Assertion
expectLine h expected = do
line <- hGetLine h
Expand Down Expand Up @@ -73,6 +83,7 @@ test = do
projectRoot <- getProjectRoot
openocdCfgPath <- getOpenOcdCfgPath
gdbCmdPath <- getGdbCmdPath
gdb <- getGdb

let
vexRiscvProc = (proc simulateExecPath [printElfPath]){
Expand All @@ -85,7 +96,7 @@ test = do
, cwd = Just projectRoot
}

gdbProc = (proc "gdb" ["--command", gdbCmdPath]){
gdbProc = (proc gdb ["--command", gdbCmdPath]){
std_out = CreatePipe, -- Comment this line to see GDB output
cwd = Just projectRoot
}
Expand Down

0 comments on commit 2cec213

Please sign in to comment.