aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2020-04-09 09:45:20 -0700
committerEddie Hung <eddie@fpgeh.com>2020-04-09 09:45:20 -0700
commitf11dd6e20838bce1b1fa8e085570d2126484d10f (patch)
treed09422f93752b15014d53ce79835816d24b2e505 /tests/various
parent60ffc21e648693ca13000f83a72dff351de4c998 (diff)
downloadyosys-f11dd6e20838bce1b1fa8e085570d2126484d10f.tar.gz
yosys-f11dd6e20838bce1b1fa8e085570d2126484d10f.tar.bz2
yosys-f11dd6e20838bce1b1fa8e085570d2126484d10f.zip
tests: add a quick plugin test
Diffstat (limited to 'tests/various')
-rw-r--r--tests/various/.gitignore1
-rw-r--r--tests/various/plugin.cc15
-rw-r--r--tests/various/plugin.sh6
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/various/.gitignore b/tests/various/.gitignore
index 4b286fd61..12d4e5048 100644
--- a/tests/various/.gitignore
+++ b/tests/various/.gitignore
@@ -3,3 +3,4 @@
/write_gzip.v
/write_gzip.v.gz
/run-test.mk
+/plugin.so
diff --git a/tests/various/plugin.cc b/tests/various/plugin.cc
new file mode 100644
index 000000000..be305fbda
--- /dev/null
+++ b/tests/various/plugin.cc
@@ -0,0 +1,15 @@
+#include "kernel/rtlil.h"
+
+YOSYS_NAMESPACE_BEGIN
+
+struct TestPass : public Pass {
+ TestPass() : Pass("test", "test") { }
+ void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
+ {
+ size_t argidx = 1;
+ extra_args(args, argidx, design);
+ log("Plugin test passed!\n");
+ }
+} TestPass;
+
+YOSYS_NAMESPACE_END
diff --git a/tests/various/plugin.sh b/tests/various/plugin.sh
new file mode 100644
index 000000000..d6d4aee59
--- /dev/null
+++ b/tests/various/plugin.sh
@@ -0,0 +1,6 @@
+set -e
+rm -f plugin.so
+CXXFLAGS=$(../../yosys-config --cxxflags)
+CXXFLAGS=${CXXFLAGS// -I\/usr\/local\/share\/yosys\/include/ -I..\/..\/share\/include}
+../../yosys-config --exec --cxx ${CXXFLAGS} --ldflags -shared -o plugin.so plugin.cc
+../../yosys -m ./plugin.so -p "test" | grep -q "Plugin test passed!"