Skip to content

Commit

Permalink
Merge pull request #24 from sschaetz/python-package
Browse files Browse the repository at this point in the history
Provides the flow to bundle and publish SVUT on Pypi
  • Loading branch information
dpretet authored Oct 23, 2022
2 parents a8ee3e8 + 85d8d56 commit bb6ee19
Show file tree
Hide file tree
Showing 16 changed files with 131 additions and 25 deletions.
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,31 @@ test/*.vcd
test/build/
test/log
debug

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include AUTHORS
include LICENSE
include README.md
recursive-include svut/ *
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "svut"
version = "1.6.1"
authors = [
{ name="Damien Pretet", email="[email protected]" },
]
description = "SystemVerilog Unit Test (SVUT)"
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/dpretet/svut"
"Bug Tracker" = "https://github.com/dpretet/svut/issues"
49 changes: 49 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Setup module for SVUT.
"""

from setuptools import setup, find_namespace_packages
import pathlib

here = pathlib.Path(__file__).parent.resolve()

long_description = (here / "README.md").read_text(encoding="utf-8")


setup(
name="svut",
version="1.6.1",
description="SystemVerilog Unit Test (SVUT)",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/dpretet/svut",
author="Damien Pretet",
author_email="[email protected]",
classifiers=[
"Development Status :: 3 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Code Generators",
"Topic :: System :: Hardware",
"Topic :: Software Development :: Testing",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
keywords="Verilog Testbench Digital-Design",
packages=find_namespace_packages(),
include_package_data=True,
python_requires=">=3.7, <4",
entry_points={
"console_scripts": [
"svutRun=svut.svutRun:main",
"svutCreate=svut.svutCreate:main",
],
},
project_urls={
"Bug Reports": "https://github.com/dpretet/svut/issues",
"Say Thanks!": "http://saythanks.io/to/example",
"Source": "https://github.com/dpretet/svut/",
},
)
File renamed without changes.
10 changes: 6 additions & 4 deletions svutCreate.py → svut/svutCreate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from string import Template
from pathlib import Path

SCRIPTDIR = os.path.abspath(os.path.dirname(__file__))

SCRIPTDIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))

def parse_verilog(verilog):

Expand Down Expand Up @@ -265,8 +264,7 @@ def print_recommandation(name):
print("")


if __name__ == '__main__':

def main():
# Handle the input arguments. A file must be passed
# and exists in file system
FILE_NAME = ""
Expand Down Expand Up @@ -309,3 +307,7 @@ def print_recommandation(name):
os.system("touch files.f")

sys.exit(0)

if __name__ == '__main__':
main()

7 changes: 4 additions & 3 deletions svutRun.py → svut/svutRun.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,7 @@ def get_git_tag():
os.chdir(curr_path)
return git_tag


if __name__ == '__main__':

def main():
PARSER = argparse.ArgumentParser(description='SystemVerilog Unit Test Flow')

# SVUT options
Expand Down Expand Up @@ -404,3 +402,6 @@ def get_git_tag():
print()

sys.exit(cmdret)

if __name__ == '__main__':
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion svutCreate
2 changes: 1 addition & 1 deletion svutRun
4 changes: 2 additions & 2 deletions test/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rm -f lint.txt; touch lint.txt
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

echo "Lint svutRun.py"
pylint -d C0301 -d C0103 $DIR/../svutRun.py | tee -a lint.txt
pylint -d C0301 -d C0103 $DIR/../svut/svutRun.py | tee -a lint.txt
ret=$?

if [[ $ret != 0 ]]; then
Expand All @@ -16,7 +16,7 @@ else
fi

echo "Lint svutCreate.py"
pylint -d C0301 -d C0103 $DIR/../svutCreate.py | tee -a lint.txt
pylint -d C0301 -d C0103 $DIR/../svut/svutCreate.py | tee -a lint.txt
ret=$?

if [[ $ret != 0 ]]; then
Expand Down
4 changes: 2 additions & 2 deletions test/testsuite_examples.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
test_run_ffd_example_icarus() { #@test

run bash -c "cd ../example && "$DIR/../svutRun" -test ffd_testbench.sv -sim icarus"
run bash -c "cd ../example && svutRun -test ffd_testbench.sv -sim icarus"
[ "$status" -eq 0 ]
}

test_run_ffd_example_verilator_failure() { #@test

run bash -c "cd ../example && "$DIR/../svutRun" -test ffd_testbench.sv -sim verilator"
run bash -c "cd ../example && svutRun -test ffd_testbench.sv -sim verilator"
[ "$status" -eq 1 ]
}
8 changes: 4 additions & 4 deletions test/testsuite_run.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
test_run_ok_testsuite() { #@test

run "$DIR/../svutRun" -test "$DIR/Adder_OK_testsuite.sv" -define "MYDEF1=5;MYDEF2"
run svutRun -test "$DIR/Adder_OK_testsuite.sv" -define "MYDEF1=5;MYDEF2"
[ "$status" -eq 0 ]
}

test_run_ok_testsuite_failure() { #@test

run "$DIR/../svutRun" -test "$DIR/Adder_OK_testsuite.sv"
run svutRun -test "$DIR/Adder_OK_testsuite.sv"
[ "$status" -eq 1 ]
}


test_run_ko_testsuite() { #@test

run "$DIR/../svutRun" -test "$DIR/Adder_KO_testsuite.sv"
run svutRun -test "$DIR/Adder_KO_testsuite.sv"
[ "$status" -eq 0 ]
}

Expand All @@ -32,5 +32,5 @@ test_run_ko_testsuite_error_count_failure() { #@test
}

function exe_ko_to_log() {
"$DIR/../svutRun" -test "$DIR/Adder_KO_testsuite.sv" | tee log
svutRun -test "$DIR/Adder_KO_testsuite.sv" | tee log
}
16 changes: 8 additions & 8 deletions test/testsuite_run_args.sh
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
test_run_wrong_run_compile_only() { #@test

run "$DIR/../svutRun.py" "-run-only" "-compile-only"
run "$DIR/../svut/svutRun.py" "-run-only" "-compile-only"
[ "$status" -eq 1 ]
}

test_run_all_with_run_only() { #@test

run "$DIR/../svutRun.py" "-run-only"
run "$DIR/../svut/svutRun.py" "-run-only"
[ "$status" -eq 1 ]
}

test_run_all_with_compile_only() { #@test

run "$DIR/../svutRun.py" "-compile-only"
run "$DIR/../svut/svutRun.py" "-compile-only"
[ "$status" -eq 1 ]
}

test_run_wrong_simulator() { #@test

run "$DIR/../svutRun.py" "-sim" "xxx"
run "$DIR/../svut/svutRun.py" "-sim" "xxx"
[ "$status" -eq 1 ]
}

test_run_version() { #@test

run "$DIR/../svutRun.py" "-version"
run "$DIR/../svut/svutRun.py" "-version"
[ "$status" -eq 0 ]
}

test_run_no_tb_present_to_scan() { #@test

run "$DIR/../svutRun.py" "-test" "../"
run "$DIR/../svut/svutRun.py" "-test" "../"
[ "$status" -eq 1 ]
}

test_run_not_a_tb_path() { #@test

run "$DIR/../svutRun.py" "-test" "../example/"
run "$DIR/../svut/svutRun.py" "-test" "../example/"
[ "$status" -eq 1 ]
}

test_run_dry_run() { #@test

run "$DIR/../svutRun.py" "-test" "../example/ffd_testbench.sv" "-dry-run"
run "$DIR/../svut/svutRun.py" "-test" "../example/ffd_testbench.sv" "-dry-run"
[ "$status" -eq 0 ]
}

0 comments on commit bb6ee19

Please sign in to comment.