Skip to content

Commit

Permalink
add oda check to json.test
Browse files Browse the repository at this point in the history
  • Loading branch information
rurban committed Dec 31, 2023
1 parent ecad469 commit 3863bc3
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/oda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: ODA
on:
push:
branches:
- master
- smoke/*
- work/oda

# cancel older workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
oda:
runs-on: ubuntu-22.04
timeout-minutes: 50
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: recursive
- name: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pyvista/setup-headless-display-action@v1
- run: |
wget -q https://download.opendesign.com/guestfiles/Demo/ODAFileConverter_QT5_lnxX64_8.3dll_24.9.deb
sudo add-apt-repository -y ppa:linuxuprising/libpng12
sudo apt update
sudo apt-get -y install libpng12-0 qt5dxcb-plugin
sudo dpkg -i ODAFileConverter_QT5_lnxX64_8.3dll_24.9.deb
cd /usr/lib/x86_64-linux-gnu
sudo ln -s libxcb-util.so.1 libxcb-util.so.0
- run: |
export QT_DEBUG_PLUGINS=1
ODAFileConverter test/test-data . ACAD2000 DXF 0 0 example_2000.dwg || true
test -f example_2000.dxf || (cat example_2000.dxf.err; exit 1)
echo ODAFileConverter works ok
export QT_DEBUG_PLUGINS=
- run: sh autogen.sh
- run: CFLAGS=-O0 ./configure --disable-bindings
- run: make -j
- run: make -j check -C programs TESTS=json.test
# this makes it green, but we want it red
#continue-on-error: true
78 changes: 77 additions & 1 deletion programs/json.test.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# json.test
#
# Copyright (C) 2018-2023 Free Software Foundation, Inc.
Expand Down Expand Up @@ -135,6 +135,82 @@ for dwg in $DATA $TODO; do
check_roundtrip
done

# teigha supports r9-r2018. r2.10: Unsupported early .dwg file version
can_teigha=1
case $(uname) in
Darwin) TeighaFileConverter=/Applications/TeighaFileConverter.app/Contents/MacOS/TeighaFileConverter ;;
Linux) TeighaFileConverter=/usr/bin/TeighaFileConverter ;;
Windows) TeighaFileConverter=TeighaFileConverter ;;
*) can_teigha=0 ;;
esac
if [ ! -x "$TeighaFileConverter" ]; then
case $(uname) in
Darwin) TeighaFileConverter=/Applications/ODAFileConverter.app/Contents/MacOS/ODAFileConverter ;;
Linux) TeighaFileConverter=/usr/bin/ODAFileConverter ;;
Windows) TeighaFileConverter=ODAFileConverter ;;
esac
fi

check_oda() {
if [ -x "$TeighaFileConverter" ]
then
b="$(basename "$dwg")"
dir="$(dirname "$dwg")"
r="$(basename "$dir")"
can_teigha=1
#DATA=sample_2000 example_2000 example_2004 example_2007 example_2010
# example_2013 example_2018 example_r14 example_r13
# r11/entities-3d r2.10/entities r2.6/entities r10/entities r9/entities
# 2010/Text 2010/Leader 2018/Constraints
case $r in
20*) ;;
r9) r=9 ;;
r11) r=12 ;;
r1[0234]) r=${r:1} ;;
r[12]\.*) r=${r:1}
can_teigha=
;;
.) case $b in
*_20*) r="${b:(-4)}" ;;
*_r9) r=9 ;;
*_r11) r=12 ;;
*_r1[0234]) r="${b:(-2)}" ;;
esac
;;
esac
if [ -n "$can_teigha" ] && [ ! -f "$b.dwg" ]; then
if [ ! -f "$b.json" ]; then
#echo "dwgread${EXEEXT}" -o"$b.json" "${DATADIR}/$dwg.dwg"
$TESTPROG "./dwgread${EXEEXT}" -o"$b.json" "${DATADIR}/$dwg.dwg" 2>/dev/null
fi
#echo "./dwgwrite${EXEEXT} -y -v0 -o $b.dwg $b.json"
$TESTPROG "./dwgwrite${EXEEXT}" -y -v0 -o "$b.dwg" "$b.json" 2>/dev/null
fi
if [ -n "$can_teigha" ] && [ -f "$b.dwg" ]; then
echo TeighaFileConverter . .. "ACAD$r" DXF 0 1 "$b.dwg" from "$dwg"
$TeighaFileConverter . .. "ACAD$r" DXF 0 1 "$b.dwg" >/dev/null 2>/dev/null
if [ -e "../$b.dxf.err" ]; then
mv "../$b.dxf.err" "$b.json.err"
cat "$b.json.err"
i=$((i+1))
fi
rm -f "../$b.dxf"
else
rm -f "./$b.json.err" 2>/dev/null
fi
fi
}

if [ -x "$TeighaFileConverter" ]
then
echo TeighaFileConverter roundtrip checks
for dwg in $DATA 2010/Text 2010/Leader 2018/Constraints; do
check_oda
done
else
echo "(Teigha|ODA)FileConverter not installed"
fi

if [ -n "$JQ" ]
then
# check pipe (nocomma)
Expand Down

0 comments on commit 3863bc3

Please sign in to comment.