Skip to content
This repository was archived by the owner on Feb 20, 2025. It is now read-only.

Commit 1e67ff6

Browse files
author
Matthias Koefferlein
committed
Bugfix #35 (XSectionGenerator::run not working)
- Added tests for API (run_api_tests.sh) - Version 1.10
1 parent 2da6cec commit 1e67ff6

File tree

8 files changed

+90
-4
lines changed

8 files changed

+90
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
tests/run_dir
2+
.*.swp
3+
.*.swo
4+
klayout_crash.log

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
# Version 1.10 - 2024-06-03
3+
4+
* Bugfix issue #35 (XSectionGenerator::run not working)
5+
26
# Version 1.9 - 2024-05-28
37

48
* Bugfix issue #34 ("XSection: Active Technology" not working in Windows)

src/grain.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<salt-grain>
33
<name>xsection</name>
4-
<version>1.9</version>
4+
<version>1.10</version>
55
<api-version/>
66
<title>Ruby script</title>
77
<doc>A generator for vertical cross sections of layouts using a technology description file.</doc>

src/macros/xsection.lym

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ require_relative("../ruby/xsection")
3232
module XS
3333

3434
# UPDATE THE VERSION NUMBER ON EACH RELEASE HERE
35-
VERSION = "1.9"
35+
VERSION = "1.10"
3636

3737
@xsection_processing_environment = XSectionScriptEnvironment.new
3838

src/ruby/xsection_generator.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ def layers_file(lyp_file)
488488

489489
# The basic generation method (single segment)
490490
def run(p1, p2, cv)
491-
run_multi([ p1, p2 ])
491+
run_multi([[ p1, p2 ]], cv)
492492
end
493493

494494
# The basic generation method (multiple segments)

tests/api_tests.rb

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
require "test/unit"
3+
require 'test/unit/ui/console/testrunner'
4+
5+
# NOTE: these tests are more like smoke tests
6+
# For the real tests, see "run_tests.sh"
7+
8+
class XSectionAPITest < Test::Unit::TestCase
9+
10+
def test_run
11+
12+
mw = RBA::MainWindow.instance
13+
mw.load_layout($input_file, 1)
14+
15+
cv = RBA::CellView.active
16+
17+
gen = XS::XSectionGenerator.new($xs_file)
18+
view = gen.run(RBA::DPoint.new(-1, 0), RBA::DPoint.new(1, 0), cv)
19+
20+
assert_equal("(-0.042,-2.058;2.058,0.042)", view.box.to_s)
21+
22+
end
23+
24+
def test_run_multi
25+
26+
mw = RBA::MainWindow.instance
27+
mw.load_layout($input_file, 1)
28+
29+
cv = RBA::CellView.active
30+
31+
gen = XS::XSectionGenerator.new($xs_file)
32+
view = gen.run_multi([[ RBA::DPoint.new(-1, 0), RBA::DPoint.new(0, 0) ], [ RBA::DPoint.new(0, 0), RBA::DPoint.new(1, 0) ]], cv)
33+
34+
assert_equal("(-0.042,-2.058;2.058,0.042)", view.box.to_s)
35+
36+
end
37+
38+
end
39+
40+
test_suite = XSectionAPITest.suite
41+
Test::Unit::UI::Console::TestRunner.run(test_suite)
42+

tests/run_api_tests.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash -e
2+
3+
export KLAYOUT_HOME=/dev/null
4+
5+
def_path_win="$HOME/AppData/Roaming/KLayout"
6+
if [ -e "$def_path_win" ] && [ -d "$def_path_win" ]; then
7+
echo "Adding default installation path: $def_path_win"
8+
export PATH="$def_path_win:$PATH"
9+
fi
10+
11+
# locate klayout binary
12+
for exe in klayout klayout_app.exe; do
13+
if which $exe 2>/dev/null; then
14+
klayout=$(which $exe)
15+
break
16+
fi
17+
done
18+
19+
if [ "$klayout" = "" ]; then
20+
echo "No KLayout binary found in PATH .. please set path to point to klayout binary"
21+
exit 1
22+
fi
23+
24+
echo "Using KLayout binary from: $klayout"
25+
26+
rm -rf run_dir
27+
mkdir -p run_dir
28+
29+
failed=""
30+
31+
bin=../src/macros/xsection.lym
32+
33+
export KLAYOUT_PATH=../src
34+
export KLAYOUT_HOME=run_dir
35+
36+
$klayout -nc -z -r api_tests.rb -rd xs_file=xs_etch1.xs -rd input_file=xs_test.gds
37+

tests/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ for tc_file in $tc_files; do
5353
xs_cut="-1,0;1,0"
5454
fi
5555

56-
$klayout -rx -z -rd xs_run=$tc.xs -rd xs_cut="$xs_cut" -rd xs_out=run_dir/$tc.gds "$xs_input" -r $bin
56+
$klayout -nc -rx -z -rd xs_run=$tc.xs -rd xs_cut="$xs_cut" -rd xs_out=run_dir/$tc.gds "$xs_input" -r $bin
5757

5858
if $klayout -b -rd a=au/$tc.gds -rd b=run_dir/$tc.gds -rd tol=10 -r run_xor.rb; then
5959
echo "No differences found."

0 commit comments

Comments
 (0)