diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md
index 75a3c99c8..8d86c7245 100644
--- a/macbuild/ReadMe.md
+++ b/macbuild/ReadMe.md
@@ -1,6 +1,6 @@
-Relevant KLayout version: 0.29.2
+Relevant KLayout version: 0.29.4
Author: Kazzz-S
-Last modified: 2024-06-09
+Last modified: 2024-07-10
# 1. Introduction
This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.29.0 or later for different 64-bit macOS, including:
@@ -61,7 +61,7 @@ You need to have the followings:
# 5. Command-line options of **`build4mac.py`**
-**`build4mac.py`** is the top level Python script for for building KLayout for a macOS.
+**`build4mac.py`** is the top level Python script for building KLayout for a macOS.
The operating system type is detected automatically.
```
@@ -102,7 +102,7 @@ $ [python] ./build4mac.py
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-g|--nolibgit2] : don't include libgit2 for Git package support | disabled
[-m|--make ] : option passed to 'make' | '--jobs=4'
- [-d|--debug] : enable debug mode build | disabled
+ [-d|--debug] : enable debug mode build; AddressSanitizer (ASAN) is linked | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs, including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
@@ -189,10 +189,8 @@ $ ./build4mac.py -q qt5macports -r mp33 -p mp311 -Y
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 3.3 and Homebrew Python 3.11
-> [!CAUTION]
-> To build KLayout >= 0.29.0, you need "Qt6" to address [the compilation issue](https://github.com/KLayout/klayout/issues/1599).
-> However, the current KLayout is not compliant with the latest Qt6.7.0, so you will get another compilation error.
-> Therefore, this section will be disabled for the time being.
+> [!IMPORTANT]
+> To build KLayout >= 0.29.0, you need "Qt6" >= 6.7.0 to address [the compilation issue](https://github.com/KLayout/klayout/issues/1599).
0. Install Homebrew, then install Qt6, Ruby 3.3, Python 3.11, and libgit2 by
```
@@ -225,10 +223,8 @@ $ ./build4mac.py -q qt6brew -r hb33 -p hb311 -Y
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.11
-> [!CAUTION]
-> To build KLayout >= 0.29.0, you need "Qt6" to address [the compilation issue](https://github.com/KLayout/klayout/issues/1599).
-> However, the current KLayout is not compliant with the latest Qt6.7.0, so you will get another compilation error.
-> Therefore, this section will be disabled for the time being.
+> [!IMPORTANT]
+> To build KLayout >= 0.29.0, you need "Qt6" >= 6.7.0 to address [the compilation issue](https://github.com/KLayout/klayout/issues/1599).
0. Install Homebrew, then install Qt6, Python 3.11, and libgit2 by
```
@@ -263,7 +259,7 @@ $ ./build4mac.py -q qt6brew -r sys -p hb311 -y
### 6E. Heterogeneous combination of MacPorts Qt5, System Ruby, and Homebrew Python 3.11
> [!IMPORTANT]
-> This is a practical solution for building an HW*.dmg package.
+> This is another practical solution for building a popular HW*.dmg package.
0. Install MacPorts, then install Qt5 and libgit2 by
```
@@ -347,7 +343,37 @@ A sample content (`*.app.Bash`) of the script bundle can be found in `Resources/
----
-# 7. Making a DMG installer
+# 7. QA Tests
+You can optionally conduct QA tests using the `ut_runner` executable.
+[This forum post](https://www.klayout.de/forum/discussion/comment/11012/#Comment_11012) provides information on the unit tests, mainly for Linux.
+In the macOS environment, the QA test working directory is `[ST|LW|HB]-build_directory.macQAT`, where you will find `macQAT.py`, a wrapper script for the `ut_runner` executable.
+Some required environment variables including `TESTSRC`, `TESTTMP`, and `DYLD_LIBRARY_PATH` are set by `macQAT.py`.
+
+1. Change directory to `[ST|LW|HB]-build_directory.macQAT`
+```
+cd [ST|LW|HB]-build_directory.macQAT
+```
+
+2. To print usage of `ut_runner`, run `macQAT.py` with '-u'
+```
+./macQAT.py -u
+```
+
+3. To start the KLayout main GUI window, run `macQAT.py` with '-k'
+```
+./macQAT.py -k
+```
+
+4. To normally run `ut_runner`, invoke `macQAT.py` with '-r'
+```
+./macQAT.py -r
+```
+
+If required, you can use the `-x ` option to skip some erroneous tests.
+
+----
+
+# 8. Making a DMG installer
You can make a DMG installer using another Python script **`makeDMG4mac.py`**.
This script requires a directory generated by **`build4mac.py`** with the [-y|-Y] option (refer to 6B through 6E).
diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py
index b5a512947..b0e6075d2 100755
--- a/macbuild/build4mac.py
+++ b/macbuild/build4mac.py
@@ -80,7 +80,7 @@ def GenerateUsage(platform):
usage += " [-u|--noqtuitools] : don't include uitools in Qt binding | disabled\n"
usage += " [-g|--nolibgit2] : don't include libgit2 for Git package support | disabled\n"
usage += " [-m|--make ] : option passed to 'make' | '--jobs=4'\n"
- usage += " [-d|--debug] : enable debug mode build | disabled\n"
+ usage += " [-d|--debug] : enable debug mode build; AddressSanitizer (ASAN) is linked | disabled\n"
usage += " [-c|--checkcom] : check command-line and exit without building | disabled\n"
usage += " [-y|--deploy] : deploy executables and dylibs, including Qt's Frameworks | disabled\n"
usage += " [-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled\n"
@@ -1007,6 +1007,7 @@ def Build_pymod_wheel(parameters):
# @return 0 on success; non-zero (1), otherwise
#------------------------------------------------------------------------------
def Run_Build_Command(config, parameters):
+ DebugMode = config['DebugMode']
ModuleQt = config['ModuleQt']
NoLibGit2 = config['NoLibGit2']
ToolDebug = config['ToolDebug']
@@ -1015,8 +1016,22 @@ def Run_Build_Command(config, parameters):
else:
jump2pymod_wheel = True
+ #-----------------------------------------------------------------
+ # [1] Use the AddressSanitizer (ASan) in the debug build.
+ # This environment variable is tested in ../src/klayout.pri.
+ #-----------------------------------------------------------------
+ try:
+ useAsan = os.environ['MAC_USE_ASAN']
+ except KeyError:
+ pass
+ else:
+ del os.environ['MAC_USE_ASAN']
+
+ if DebugMode:
+ os.environ['MAC_USE_ASAN'] = "1"
+
#-----------------------------------------------------
- # [1] Set two environment variables to use libgit2
+ # [2] Set two environment variables to use libgit2
#-----------------------------------------------------
if not NoLibGit2:
# Using MacPorts
@@ -1048,7 +1063,7 @@ def Run_Build_Command(config, parameters):
if not jump2pymod_wheel:
#-----------------------------------------------------
- # [2] Set parameters passed to the main Bash script
+ # [3] Set parameters passed to the main Bash script
#-----------------------------------------------------
cmd_args = ""
@@ -1106,7 +1121,7 @@ def Run_Build_Command(config, parameters):
cmd_args += " \\\n -nopython"
#-----------------------------------------------------
- # [3] Make the consolidated command line
+ # [4] Make the consolidated command line
#-----------------------------------------------------
command = "time"
command += " \\\n %s" % parameters['build_cmd']
@@ -1119,7 +1134,7 @@ def Run_Build_Command(config, parameters):
sys.exit(0)
#-----------------------------------------------------
- # [4] Invoke the main Bash script; takes time:-)
+ # [5] Invoke the main Bash script; takes time:-)
#-----------------------------------------------------
myscript = os.path.basename(__file__)
ret = subprocess.call( command, shell=True )
@@ -1138,7 +1153,7 @@ def Run_Build_Command(config, parameters):
print( "", file=sys.stderr )
#------------------------------------------------------------------------
- # [5] Prepare "*.macQAT/" directory for the QATest.
+ # [6] Prepare "*.macQAT/" directory for the QATest.
# Binaries under "*.macQAT/" such as *.dylib will be touched later.
#------------------------------------------------------------------------
print( "### Preparing <%s>" % MacBuildDirQAT )
@@ -1177,7 +1192,7 @@ def Run_Build_Command(config, parameters):
print( "", file=sys.stderr )
#------------------------------------------------------------------------
- # [6] Build for some predetermined environments on demand
+ # [7] Build for some predetermined environments on demand
#------------------------------------------------------------------------
BuildPymodWhl = parameters['BuildPymodWhl']
if BuildPymodWhl:
diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py
index 8f0e09dcc..6436b11cc 100755
--- a/macbuild/build4mac_env.py
+++ b/macbuild/build4mac_env.py
@@ -182,7 +182,7 @@ RubySonoma = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/
# install with 'sudo port install ruby33'
# [Key Type Name] = 'MP33'
Ruby33MacPorts = { 'exe': '/opt/local/bin/ruby3.3',
- 'inc': '/opt/local/include/ruby-3.3.3',
+ 'inc': '/opt/local/include/ruby-3.3.4',
'lib': '/opt/local/lib/libruby.3.3.dylib'
}
diff --git a/macbuild/macQAT.py b/macbuild/macQAT.py
index bd73ddcc1..0dc26e24d 100755
--- a/macbuild/macQAT.py
+++ b/macbuild/macQAT.py
@@ -107,7 +107,7 @@ def GetTimeStamp():
def ParseCommandLineArguments():
global Usage
global RunnerUsage
- global StartKLayout
+ global StartKLayout
global Run
global ContinueOnError
global TestsExcluded
@@ -216,7 +216,9 @@ def ExportEnvVariables():
MyEnviron[ 'TESTTMP' ] = WorkDir
if System == "Darwin":
MyEnviron[ 'DYLD_LIBRARY_PATH' ] = "%s:%s/db_plugins:%s/lay_plugins:%s/pymod" % (ProjectDir, ProjectDir, ProjectDir, ProjectDir)
- for env in [ 'TESTSRC', 'TESTTMP', 'DYLD_LIBRARY_PATH' ]:
+ MyEnviron[ 'MallocNanoZone' ] = "0"
+ MyEnviron[ 'ASAN_OPTIONS' ] = "ast_unwind_on_malloc=0:verbosity=1:detect_leaks=0:abort_on_error=0:halt_on_error=0:symbolize=1"
+ for env in [ 'TESTSRC', 'TESTTMP', 'DYLD_LIBRARY_PATH', 'MallocNanoZone', 'ASAN_OPTIONS' ]:
os.environ[env] = MyEnviron[env]
else:
MyEnviron[ 'LD_LIBRARY_PATH' ] = "%s:%s/db_plugins:%s/lay_plugins:%s/pymod" % (ProjectDir, ProjectDir, ProjectDir, ProjectDir)
@@ -283,7 +285,7 @@ def Main():
#-------------------------------------------------------
if StartKLayout:
StartKLatyouGUIWindow()
-
+
#-------------------------------------------------------
# [4] Run the unit tester
#-------------------------------------------------------
diff --git a/macbuild/makeDMG4mac.py b/macbuild/makeDMG4mac.py
index 1cdd03cde..cedfe3de1 100755
--- a/macbuild/makeDMG4mac.py
+++ b/macbuild/makeDMG4mac.py
@@ -49,6 +49,7 @@ def SetGlobals():
global DMGSerialNum # the DMG serial number
global PackagePrefix # the package prefix: LW-', 'HW-', or 'EX-'
global QtIdentification # Qt identification
+ global BuildType # build type ['release', 'debug']
global RubyPythonID # Ruby- and Python-identification
global KLVersion # KLayout's version
global OccupiedDS # approx. occupied disc space
@@ -144,6 +145,7 @@ def SetGlobals():
DMGSerialNum = 1
PackagePrefix = ""
QtIdentification = ""
+ BuildType = ""
RubyPythonID = ""
KLVersion = GetKLayoutVersionFrom( "./version.sh" )
OccupiedDS = -1
@@ -236,6 +238,7 @@ def CheckPkgDirectory():
global BundleName
global PackagePrefix
global QtIdentification
+ global BuildType
global RubyPythonID
global BackgroundPNG
global LatestOSMacPorts
@@ -270,7 +273,8 @@ def CheckPkgDirectory():
# * ST-qt6MP.pkg.macos-Monterey-release-RsysPsys
# * LW-qt6MP.pkg.macos-Monterey-release-Rmp33Pmp311
#-----------------------------------------------------------------------------------------------
- patQRP = u'(ST|LW|HW|EX)([-])([qt5|qt6][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
+ # 0 1 2 3 4 5 6 7
+ patQRP = u'(ST|LW|HW|EX)([-])([qt5|qt6][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-])(release|debug)([-])([0-9A-Za-z]+)'
regQRP = re.compile(patQRP)
if not regQRP.match(PkgDir):
print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" )
@@ -283,7 +287,6 @@ def CheckPkgDirectory():
pkgdirComponents = regQRP.match(PkgDir).groups()
PackagePrefix = pkgdirComponents[0]
QtIdentification = pkgdirComponents[2]
- RubyPythonID = pkgdirComponents[5]
if QtIdentification.find('qt5') == 0:
BackgroundPNG = "KLayoutDMG-BackQt5.png"
elif QtIdentification.find('qt6') == 0:
@@ -291,6 +294,14 @@ def CheckPkgDirectory():
else:
BackgroundPNG = None
raise Exception( "! neither qt5 nor qt6" )
+ if pkgdirComponents[5] == 'release':
+ BuildType = 'release'
+ elif pkgdirComponents[5] == 'debug':
+ BuildType = 'debug'
+ else:
+ BuildType = None
+ raise Exception( "! neither release nor debug" )
+ RubyPythonID = pkgdirComponents[7]
#-----------------------------------------------------------------------------
# [3] Check if the "LatestOS" with MacPorts / Homebrew / Anaconda3
@@ -435,6 +446,7 @@ def ParseCommandLineArguments():
global UnsafePkg
global PackagePrefix
global QtIdentification
+ global BuildType
global RubyPythonID
global KLVersion
global OccupiedDS
@@ -532,6 +544,8 @@ def ParseCommandLineArguments():
% (PackagePrefix, KLVersion, GenOSName, Platform, DMGSerialNum, QtIdentification, RubyPythonID)
if Machine == "arm64": # with an Apple Silicon Chip
TargetDMG = Machine + TargetDMG
+ if BuildType == "debug": # in the case of 'debug' build
+ TargetDMG = "debug-" + TargetDMG
return
#------------------------------------------------------------------------------
@@ -607,7 +621,7 @@ def MakeTargetDMGFile(msg=""):
#----------------------------------------------------
if os.path.exists(WorkDMG):
os.remove(WorkDMG)
- dmgsize = OccupiedDS + 20 # approx. occupied size plus 20[MB]
+ dmgsize = OccupiedDS + int(0.2*OccupiedDS) # approx. occupied size plus 20[%]
cmdline = 'hdiutil create -srcfolder %s -volname %s -fs HFS+ -fsargs "-c c=64,a=16,e=16" '
cmdline += '-format UDRW -size %dm %s'
command = cmdline % (PkgDir, VolumeDMG, dmgsize, WorkDMG)
diff --git a/macbuild/nightlyBuild.py b/macbuild/nightlyBuild.py
index 5732900ed..79c27c486 100755
--- a/macbuild/nightlyBuild.py
+++ b/macbuild/nightlyBuild.py
@@ -78,8 +78,8 @@ def Get_Build_Target_Dict():
# @param[in] platform platform name
#
# @return (dictionary1, dictionary2)-tupple
-# dictionary1: key=(qtVer, mnemonic), value=build option list
-# dictionary2: key=(qtVer, mnemonic), value=log file name
+# dictionary1: key=(qtVer, mnemonic, bdType), value=build option list
+# dictionary2: key=(qtVer, mnemonic, bdType), value=log file name
#------------------------------------------------------------------------------
def Get_Build_Options( targetDic, platform ):
buildOp = dict()
@@ -94,38 +94,61 @@ def Get_Build_Options( targetDic, platform ):
for key in targetDic.keys():
target = targetDic[key]
if target == "std":
- buildOp[(qtVer, "std")] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ]
- logfile[(qtVer, "std")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPsys")
+ buildOp[(qtVer, "std", "r")] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ]
+ logfile[(qtVer, "std", "r")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPsys")
+ buildOp[(qtVer, "std", "d")] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys', '--debug' ]
+ logfile[(qtVer, "std", "d")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "RsysPsys")
elif target == "ports":
- buildOp[(qtVer, "ports")] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP33', '-p', 'MP311' ]
- logfile[(qtVer, "ports")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rmp33Pmp311")
+ buildOp[(qtVer, "ports", "r")] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP33', '-p', 'MP311' ]
+ logfile[(qtVer, "ports", "r")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rmp33Pmp311")
+ buildOp[(qtVer, "ports", "d")] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP33', '-p', 'MP311', '--debug' ]
+ logfile[(qtVer, "ports", "d")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "Rmp33Pmp311")
elif target == "brew":
- buildOp[(qtVer, "brew")] = [ '-q', '%sBrew' % qtType, '-r', 'HB33', '-p', 'HB311' ]
- logfile[(qtVer, "brew")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb33Phb311")
+ buildOp[(qtVer, "brew", "r")] = [ '-q', '%sBrew' % qtType, '-r', 'HB33', '-p', 'HB311' ]
+ logfile[(qtVer, "brew", "r")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb33Phb311")
+ buildOp[(qtVer, "brew", "d")] = [ '-q', '%sBrew' % qtType, '-r', 'HB33', '-p', 'HB311', '--debug' ]
+ logfile[(qtVer, "brew", "d")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "Rhb33Phb311")
elif target == "brewHW":
- buildOp[(qtVer, "brewHW")] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB311' ]
- logfile[(qtVer, "brewHW")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhb311")
+ buildOp[(qtVer, "brewHW", "r")] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB311' ]
+ logfile[(qtVer, "brewHW", "r")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhb311")
+ buildOp[(qtVer, "brewHW", "d")] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB311', '--debug' ]
+ logfile[(qtVer, "brewHW", "d")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "RsysPhb311")
elif target == "ana3":
- buildOp[(qtVer, "ana3")] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ]
- logfile[(qtVer, "ana3")] = "%sAna3.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rana3Pana3")
+ buildOp[(qtVer, "ana3", "r")] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ]
+ logfile[(qtVer, "ana3", "r")] = "%sAna3.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rana3Pana3")
+ buildOp[(qtVer, "ana3", "d")] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3', '--debug' ]
+ logfile[(qtVer, "ana3", "d")] = "%sAna3.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "Rana3Pana3")
elif target == "brewA":
- buildOp[(qtVer, "brewA")] = [ '-q', '%sBrew' % qtType, '-r', 'HB33', '-p', 'HBAuto' ]
- logfile[(qtVer, "brewA")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb33Phbauto")
+ buildOp[(qtVer, "brewA", "r")] = [ '-q', '%sBrew' % qtType, '-r', 'HB33', '-p', 'HBAuto' ]
+ logfile[(qtVer, "brewA", "r")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb33Phbauto")
+ buildOp[(qtVer, "brewA", "d")] = [ '-q', '%sBrew' % qtType, '-r', 'HB33', '-p', 'HBAuto', '--debug' ]
+ logfile[(qtVer, "brewA", "d")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "Rhb33Phbauto")
elif target == "brewAHW":
- buildOp[(qtVer, "brewAHW")] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HBAuto' ]
- logfile[(qtVer, "brewAHW")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhbauto")
+ buildOp[(qtVer, "brewAHW", "r")] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HBAuto' ]
+ logfile[(qtVer, "brewAHW", "r")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhbauto")
+ buildOp[(qtVer, "brewAHW", "d")] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HBAuto', '--debug' ]
+ logfile[(qtVer, "brewAHW", "d")] = "%sBrew.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "RsysPhbauto")
elif target == "pbrew":
- buildOp[(qtVer, "pbrew")] = [ '-q', '%sMacPorts' % qtType, '-r', 'HB33', '-p', 'HB311' ]
- logfile[(qtVer, "pbrew")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb33Phb311")
+ buildOp[(qtVer, "pbrew", "r")] = [ '-q', '%sMacPorts' % qtType, '-r', 'HB33', '-p', 'HB311' ]
+ logfile[(qtVer, "pbrew", "r")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "Rhb33Phb311")
+ buildOp[(qtVer, "pbrew", "d")] = [ '-q', '%sMacPorts' % qtType, '-r', 'HB33', '-p', 'HB311', '--debug' ]
+ logfile[(qtVer, "pbrew", "d")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "Rhb33Phb311")
elif target == "pbrewHW":
- buildOp[(qtVer, "pbrewHW")] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'HB311' ]
- logfile[(qtVer, "pbrewHW")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhb311")
+ buildOp[(qtVer, "pbrewHW", "r")] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'HB311' ]
+ logfile[(qtVer, "pbrewHW", "r")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "release", "RsysPhb311")
+ buildOp[(qtVer, "pbrewHW", "d")] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'HB311', '--debug' ]
+ logfile[(qtVer, "pbrewHW", "d")] = "%sMP.build.macos-%s-%s-%s.log" % (qtType.lower(), platform, "debug", "RsysPhb311")
if WithPymod:
- buildOp[(qtVer,"ports")] = buildOp[(qtVer,"ports")] + ['--buildPymod']
- buildOp[(qtVer,"brew")] = buildOp[(qtVer,"brew")] + ['--buildPymod']
- buildOp[(qtVer,"ana3")] = buildOp[(qtVer,"ana3")] + ['--buildPymod']
- buildOp[(qtVer,"pbrew")] = buildOp[(qtVer,"pbrew")] + ['--buildPymod']
+ buildOp[(qtVer, "ports", "r")] = buildOp[(qtVer, "ports", "r")] + ['--buildPymod']
+ buildOp[(qtVer, "brew", "r")] = buildOp[(qtVer, "brew", "r")] + ['--buildPymod']
+ buildOp[(qtVer, "ana3", "r")] = buildOp[(qtVer, "ana3", "r")] + ['--buildPymod']
+ buildOp[(qtVer, "pbrew", "r")] = buildOp[(qtVer, "pbrew", "r")] + ['--buildPymod']
+
+ buildOp[(qtVer, "ports", "d")] = buildOp[(qtVer, "ports", "d")]
+ buildOp[(qtVer, "brew", "d")] = buildOp[(qtVer, "brew", "d")]
+ buildOp[(qtVer, "ana3", "d")] = buildOp[(qtVer, "ana3", "d")]
+ buildOp[(qtVer, "pbrew", "d")] = buildOp[(qtVer, "pbrew", "d")]
return (buildOp, logfile)
@@ -135,7 +158,7 @@ def Get_Build_Options( targetDic, platform ):
# @param[in] targetDic build target dictionary
# @param[in] platform platform name
#
-# @return a dictionary; key=(qtVer, mnemonic), value=".macQAT" directory
+# @return a dictionary; key=(qtVer, mnemonic, bdType), value=".macQAT" directory
#------------------------------------------------------------------------------
def Get_QAT_Directory( targetDic, platform ):
dirQAT = dict()
@@ -149,23 +172,32 @@ def Get_QAT_Directory( targetDic, platform ):
for key in targetDic.keys():
target = targetDic[key]
if target == "std":
- dirQAT[(qtVer, "std")] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "std", "r")] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "std", "d")] = '%sMP.build.macos-%s-debug-RsysPsys.macQAT' % (qtType.lower(), platform)
elif target == "ports":
- dirQAT[(qtVer, "ports")] = '%sMP.build.macos-%s-release-Rmp33Pmp311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "ports", "r")] = '%sMP.build.macos-%s-release-Rmp33Pmp311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "ports", "d")] = '%sMP.build.macos-%s-debug-Rmp33Pmp311.macQAT' % (qtType.lower(), platform)
elif target == "brew":
- dirQAT[(qtVer, "brew")] = '%sBrew.build.macos-%s-release-Rhb33Phb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brew", "r")] = '%sBrew.build.macos-%s-release-Rhb33Phb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brew", "d")] = '%sBrew.build.macos-%s-debug-Rhb33Phb311.macQAT' % (qtType.lower(), platform)
elif target == "brewHW":
- dirQAT[(qtVer, "brewHW")] = '%sBrew.build.macos-%s-release-RsysPhb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brewHW", "r")] = '%sBrew.build.macos-%s-release-RsysPhb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brewHW", "d")] = '%sBrew.build.macos-%s-debug-RsysPhb311.macQAT' % (qtType.lower(), platform)
elif target == "ana3":
- dirQAT[(qtVer, "ana3")] = '%sAna3.build.macos-%s-release-Rana3Pana3.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "ana3", "r")] = '%sAna3.build.macos-%s-release-Rana3Pana3.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "ana3", "d")] = '%sAna3.build.macos-%s-debug-Rana3Pana3.macQAT' % (qtType.lower(), platform)
elif target == "brewA":
- dirQAT[(qtVer, "brewA")] = '%sBrew.build.macos-%s-release-Rhb33Phbauto.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brewA", "r")] = '%sBrew.build.macos-%s-release-Rhb33Phbauto.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brewA", "d")] = '%sBrew.build.macos-%s-debug-Rhb33Phbauto.macQAT' % (qtType.lower(), platform)
elif target == "brewAHW":
- dirQAT[(qtVer, "brewAHW")] = '%sBrew.build.macos-%s-release-RsysPhbauto.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brewAHW", "r")] = '%sBrew.build.macos-%s-release-RsysPhbauto.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "brewAHW", "d")] = '%sBrew.build.macos-%s-debug-RsysPhbauto.macQAT' % (qtType.lower(), platform)
elif target == "pbrew":
- dirQAT[(qtVer, "pbrew")] = '%sMP.build.macos-%s-release-Rhb33Phb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "pbrew", "r")] = '%sMP.build.macos-%s-release-Rhb33Phb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "pbrew", "d")] = '%sMP.build.macos-%s-debug-Rhb33Phb311.macQAT' % (qtType.lower(), platform)
elif target == "pbrewHW":
- dirQAT[(qtVer, "pbrewHW")] = '%sMP.build.macos-%s-release-RsysPhb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "pbrewHW", "r")] = '%sMP.build.macos-%s-release-RsysPhb311.macQAT' % (qtType.lower(), platform)
+ dirQAT[(qtVer, "pbrewHW", "d")] = '%sMP.build.macos-%s-debug-RsysPhb311.macQAT' % (qtType.lower(), platform)
return dirQAT
@@ -177,7 +209,7 @@ def Get_QAT_Directory( targetDic, platform ):
# @param[in] srlDMG serial number of DMG
# @param[in] makeflag True to make; False to clean
#
-# @return a dictionary; key=(qtVer, mnemonic), value=build option list
+# @return a dictionary; key=(qtVer, mnemonic, bdType), value=build option list
#------------------------------------------------------------------------------
def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
packOp = dict()
@@ -196,52 +228,70 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
for key in targetDic.keys():
target = targetDic[key]
if target == "std":
- packOp[(qtVer, "std")] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "std", "r")] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "std", "d")] = [ '-p', 'ST-%sMP.pkg.macos-%s-debug-RsysPsys' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ports":
- packOp[(qtVer, "ports")] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp33Pmp311' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "ports", "r")] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp33Pmp311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "ports", "d")] = [ '-p', 'LW-%sMP.pkg.macos-%s-debug-Rmp33Pmp311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brew":
- packOp[(qtVer, "brew")] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb33Phb311' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brew", "r")] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb33Phb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brew", "d")] = [ '-p', 'LW-%sBrew.pkg.macos-%s-debug-Rhb33Phb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewHW":
- packOp[(qtVer, "brewHW")] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb311' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brewHW", "r")] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brewHW", "d")] = [ '-p', 'HW-%sBrew.pkg.macos-%s-debug-RsysPhb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ana3":
- packOp[(qtVer, "ana3")] = [ '-p', 'LW-%sAna3.pkg.macos-%s-release-Rana3Pana3' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "ana3", "r")] = [ '-p', 'LW-%sAna3.pkg.macos-%s-release-Rana3Pana3' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "ana3", "d")] = [ '-p', 'LW-%sAna3.pkg.macos-%s-debug-Rana3Pana3' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewA":
- packOp[(qtVer, "brewA")] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb33Phbauto' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brewA", "r")] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb33Phbauto' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brewA", "d")] = [ '-p', 'LW-%sBrew.pkg.macos-%s-debug-Rhb33Phbauto' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewAHW":
- packOp[(qtVer, "brewAHW")] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhbauto' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brewAHW", "r")] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhbauto' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "brewAHW", "d")] = [ '-p', 'HW-%sBrew.pkg.macos-%s-debug-RsysPhbauto' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "pbrew":
- packOp[(qtVer, "pbrew")] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rhb33Phb311' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "pbrew", "r")] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rhb33Phb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "pbrew", "d")] = [ '-p', 'LW-%sMP.pkg.macos-%s-debug-Rhb33Phb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
elif target == "pbrewHW":
- packOp[(qtVer, "pbrewHW")] = [ '-p', 'HW-%sMP.pkg.macos-%s-release-RsysPhb311' % (qtType.lower(), platform),
- '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "pbrewHW", "r")] = [ '-p', 'HW-%sMP.pkg.macos-%s-release-RsysPhb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
+ packOp[(qtVer, "pbrewHW", "d")] = [ '-p', 'HW-%sMP.pkg.macos-%s-debug-RsysPhb311' % (qtType.lower(), platform),
+ '-s', '%d' % srlDMG, '%s' % flag ]
return packOp
#------------------------------------------------------------------------------
## To parse the command line arguments
#------------------------------------------------------------------------------
def Parse_CommandLine_Arguments():
- global Usage # usage
- global QtType # Qt type
- global Target # target list
- global QtTarget # list of (Qt, target)-tuple
- global Build # operation flag
- global WithPymod # operation flag
- global QATest # operation flag
- global QACheck # operation flag
- global MakeDMG # operation flag
- global CleanDMG # operation flag
- global Upload # operation flag
- global SrlDMG # DMG serial number
- global Dropbox # Dropbox directory
- global DryRun # True for dry-run
+ global Usage # usage
+ global QtType # Qt type
+ global Target # target list
+ global QtTarget # list of (Qt, target, bdType)-tuple
+ global Build # operation flag
+ global WithPymod # operation flag
+ global QATest # operation flag
+ global QACheck # operation flag
+ global MakeDMG # operation flag
+ global CleanDMG # operation flag
+ global Upload # operation flag
+ global SrlDMG # DMG serial number
+ global Dropbox # Dropbox directory
+ global DryRun # True for dry-run
platform = Test_My_Platform()
if platform in [ "Sonoma", "Ventura", "Monterey" ]:
@@ -262,13 +312,14 @@ def Parse_CommandLine_Arguments():
Usage += " [--target ] : 0='std', 1='ports', 2='brew', 3='brewHW', 4='ana3', | '%s'\n" % targetopt
Usage += " 5='brewA', 6='brewAHW', 12='pbrew', 13='pbrewHW' |\n"
Usage += " * with --qt=6, use --target='0,1,2,3' (4 is ignored) |\n"
- Usage += " [--qttarget ] : ex. '5,1' for qt=5, target=1 | disabled\n"
+ Usage += " [--qttarget ] : ex. '5,1,r'| qt=5, target=1, bdType='r' | disabled\n"
+ Usage += " '5,4,d', '6,4,r', and '6,4,d' are omitted |\n"
Usage += " + This option supersedes, if used, the --qt and --target combination. |\n"
Usage += " + You can use this option multiple times. |\n"
Usage += " + Or you can pass those list by the 'nightlyBuild.csv' file. |\n"
Usage += " A sample file 'macbuild/nightlyBuild.sample.csv' is available. |\n"
Usage += " [--build] : build and deploy | disabled\n"
- Usage += " [--pymod] : build and deploy Pymod, too | disabled\n"
+ Usage += " [--pymod] : build and deploy Pymod, too (release build only) | disabled\n"
Usage += " [--test] : run the QA Test | disabled\n"
Usage += " [--check] : check the QA Test results | disabled\n"
Usage += " [--makedmg|--cleandmg ] : make or clean DMGs | disabled\n"
@@ -302,7 +353,7 @@ def Parse_CommandLine_Arguments():
p.add_option( '--qttarget',
action='append',
dest='qt_target',
- help='(Qt, target)-tuple' )
+ help='(Qt, target, bdType)-tuple' )
p.add_option( '--build',
action='store_true',
@@ -396,10 +447,10 @@ def Parse_CommandLine_Arguments():
# Populate QtTarget
QtTarget = list()
for target in Target:
- QtTarget.append( (QtType, target) )
+ QtTarget.append( (QtType, target, 'r') )
QtType = None
Target = None
- print( "# The --qt and --target combination specifies..." )
+ print( "# The --qt and --target combination specifies for 'r'elease build..." )
print(QtTarget)
if len(opt.qt_target) == 1 and opt.qt_target[0] == "nightlyBuild.csv": # reserved file name
@@ -411,18 +462,24 @@ def Parse_CommandLine_Arguments():
print(Usage)
quit()
for i in range(0, len(df)):
- qt = df.iloc[i,0]
- idx = df.iloc[i,1]
- if (qt == 5 and idx in [0,1,2,3,4,5,6,12,13]) or (qt == 6 and idx in [0,1,2,3, 5,6,12,13]):
- QtTarget.append( (qt, targetDic[idx]) )
+ qt = df.iloc[i,0]
+ idx = df.iloc[i,1]
+ bdType = df.iloc[i,2].lower()[0]
+ if (qt == 5 and idx in [0,1,2,3,4,5,6,12,13] and bdType in ['r']) or \
+ (qt == 5 and idx in [0,1,2,3, 5,6,12,13] and bdType in ['d']) or \
+ (qt == 6 and idx in [0,1,2,3, 5,6,12,13] and bdType in ['r', 'd']):
+ QtTarget.append( (qt, targetDic[idx], bdType) )
elif len(opt.qt_target) > 0:
QtTarget = list()
withqttarget = True
for item in opt.qt_target:
- qt = int(item.split(",")[0])
- idx = int(item.split(",")[1])
- if (qt == 5 and idx in [0,1,2,3,4,5,6,12,13]) or (qt == 6 and idx in [0,1,2,3, 5,6,12,13]):
- QtTarget.append( (qt, targetDic[idx]) )
+ qt = int(item.split(",")[0])
+ idx = int(item.split(",")[1])
+ bdType = (item.split(",")[2]).lower()[0]
+ if (qt == 5 and idx in [0,1,2,3,4,5,6,12,13] and bdType in ['r']) or \
+ (qt == 5 and idx in [0,1,2,3, 5,6,12,13] and bdType in ['d']) or \
+ (qt == 6 and idx in [0,1,2,3, 5,6,12,13] and bdType in ['r', 'd']):
+ QtTarget.append( (qt, targetDic[idx], bdType) )
else:
withqttarget = False
@@ -431,7 +488,7 @@ def Parse_CommandLine_Arguments():
print( "# The --qttarget option superseded the --qt and --target combination" )
print(QtTarget)
else:
- print( "! --qttarget is used but there is no valid (Qt, target)-tuple" )
+ print( "! --qttarget is used but there is no valid (Qt, target, bdTye)-tuple" )
print(Usage)
quit()
@@ -474,18 +531,18 @@ def Build_Deploy():
myPlatform = Test_My_Platform()
buildOp, logfile = Get_Build_Options( Get_Build_Target_Dict(), myPlatform )
- for qttype, key in QtTarget:
- if key == "ana3" and qttype == 6: # anaconda3 does not provide Qt6 so far
+ for qttype, key, bdType in QtTarget:
+ if key == "ana3" and (qttype == 6 or bdType == 'd'): # anaconda3 does not provide Qt6 | debug_lib
continue
- deplog = logfile[(qttype, key)].replace( ".log", ".dep.log" )
+ deplog = logfile[(qttype, key, bdType)].replace( ".log", ".dep.log" )
- command1 = [ pyBuilder ] + buildOp[(qttype, key)]
+ command1 = [ pyBuilder ] + buildOp[(qttype, key, bdType)]
if key in [ "std", "brewHW", "brewAHW", "pbrewHW" ] :
command2 = "time"
command2 += " \\\n %s" % pyBuilder
- for option in buildOp[(qttype, key)]:
+ for option in buildOp[(qttype, key, bdType)]:
command2 += " \\\n %s" % option
command2 += " \\\n %s" % '-y'
command2 += " 2>&1 | tee %s; \\\n" % deplog
@@ -493,7 +550,7 @@ def Build_Deploy():
else:
command2 = "time"
command2 += " \\\n %s" % pyBuilder
- for option in buildOp[(qttype, key)]:
+ for option in buildOp[(qttype, key, bdType)]:
command2 += " \\\n %s" % option
command2 += " \\\n %s" % '-Y'
command2 += " 2>&1 | tee %s; \\\n" % deplog
@@ -544,8 +601,8 @@ def Run_QATest( excludeList ):
myPlatform = Test_My_Platform()
dirQAT = Get_QAT_Directory( Get_Build_Target_Dict(), myPlatform )
- for qttype, key in QtTarget:
- if key == "ana3" and qttype == 6: # anaconda3 does not provide Qt6 so far
+ for qttype, key, bdType in QtTarget:
+ if key == "ana3" and (qttype == 6 or bdType == 'd'): # anaconda3 does not provide Qt6 | debug_lib
continue
if key == "ana3":
@@ -555,9 +612,9 @@ def Run_QATest( excludeList ):
command1 = [ pyRunnerQAT ] + [ '--run' ]
if not exclude == "":
command1 += [ '--exclude', '%s' % exclude ]
- print( dirQAT[(qttype, key)], command1 )
+ print( dirQAT[(qttype, key, bdType)], command1 )
#continue
- os.chdir( dirQAT[(qttype, key)] )
+ os.chdir( dirQAT[(qttype, key, bdType)] )
if subprocess.call( command1, shell=False ) != 0:
print( "", file=sys.stderr )
@@ -585,14 +642,14 @@ def Check_QATest_Results( lines ):
myPlatform = Test_My_Platform()
dirQAT = Get_QAT_Directory( Get_Build_Target_Dict(), myPlatform )
- for qttype, key in QtTarget:
- if key == "ana3" and qttype == 6: # anaconda3 does not provide Qt6 so far
+ for qttype, key, bdType in QtTarget:
+ if key == "ana3" and (qttype == 6 or bdType == 'd'): # anaconda3 does not provide Qt6 | debug_lib
continue
- os.chdir( dirQAT[(qttype, key)] )
+ os.chdir( dirQAT[(qttype, key, bdType)] )
logfile = glob.glob( "*.log" )
command1 = [ tailCommand ] + [ '-n', '%d' % lines ] + logfile
- print( dirQAT[(qttype, key)], command1 )
+ print( dirQAT[(qttype, key, bdType)], command1 )
#continue
if subprocess.call( command1, shell=False ) != 0:
@@ -626,11 +683,11 @@ def DMG_Make( srlDMG ):
shutil.rmtree( stashDMG )
os.mkdir( stashDMG )
- for qttype, key in QtTarget:
- if key == "ana3" and qttype == 6: # anaconda3 does not provide Qt6 so far
+ for qttype, key, bdType in QtTarget:
+ if key == "ana3" and (qttype == 6 or bdType == 'd'): # anaconda3 does not provide Qt6 | debug_lib
continue
- command1 = [ pyDMGmaker ] + packOp[(qttype, key)]
+ command1 = [ pyDMGmaker ] + packOp[(qttype, key, bdType)]
print(command1)
#continue
@@ -666,11 +723,11 @@ def DMG_Clean( srlDMG ):
if os.path.isdir( stashDMG ):
shutil.rmtree( stashDMG )
- for qttype, key in QtTarget:
- if key == "ana3" and qttype == 6: # anaconda3 does not provide Qt6 so far
+ for qttype, key, bdType in QtTarget:
+ if key == "ana3" and (qttype == 6 or bdType == 'd'): # anaconda3 does not provide Qt6 | debug_lib
continue
- command1 = [ pyDMGmaker ] + packOp[(qttype, key)]
+ command1 = [ pyDMGmaker ] + packOp[(qttype, key, bdType)]
print(command1)
#continue
diff --git a/macbuild/nightlyBuild.sample.csv b/macbuild/nightlyBuild.sample.csv
index ed0f996c9..30ba786a3 100644
--- a/macbuild/nightlyBuild.sample.csv
+++ b/macbuild/nightlyBuild.sample.csv
@@ -10,19 +10,20 @@
# qtVer = 5 or 6
# target = [0='std', 1='ports', 2='brew', 3='brewHW', 4='ana3',
# 12='pbrew', 13='pbrewHW']
+# bdType = ['r(elease)', 'd(ebug)']
# note that
-# (qtVer,target)=(6,4) will be omitted
+# (qtVer,target,bdType)=(6,4,r|d) and (5,4,d) will be omitted
#-------------------------------------------------------------------------------
-qtVer,target
-5,0
-5,1
-6,2
-6,13
-5,4
-#6,0
-#6,1
-#6,2
-#6,3
-#6,4
-#6,12
-#6,13
+qtVer,target,bdType
+5,0,r
+5,1,r
+6,2,r
+6,13,r
+5,4,r
+#6,0,r
+#6,1,r
+#6,2,r
+#6,3,r
+#6,4,r
+#6,12,r
+#6,13,r
diff --git a/src/db/db/built-in-macros/pcell_declaration_helper.lym b/src/db/db/built-in-macros/pcell_declaration_helper.lym
index 98901fd3c..a380b77f7 100644
--- a/src/db/db/built-in-macros/pcell_declaration_helper.lym
+++ b/src/db/db/built-in-macros/pcell_declaration_helper.lym
@@ -361,6 +361,10 @@ module RBA
def param(name, type, description, args = {})
+ if ! args.is_a?(Hash)
+ raise("Too many positional arguments for 'param' (3 expected) - use named arguments for default value etc.")
+ end
+
if name !~ /^[_A-Za-z]\w*$/
raise "Invalid parameter name #{name} (needs to be a word)"
end
diff --git a/src/db/db/dbLayout.cc b/src/db/db/dbLayout.cc
index bcd76d706..3c16a85ed 100644
--- a/src/db/db/dbLayout.cc
+++ b/src/db/db/dbLayout.cc
@@ -2526,10 +2526,25 @@ Layout::register_pcell (const std::string &name, pcell_declaration_type *declara
// replace any existing PCell declaration with that name.
id = pcid->second;
if (m_pcells [id]) {
- delete m_pcells [id];
- }
- m_pcells [id] = new pcell_header_type (id, name, declaration);
+ std::unique_ptr org_header (m_pcells [id]);
+ std::vector variants;
+ for (auto v = org_header->begin (); v != org_header->end (); ++v) {
+ variants.push_back (v->second);
+ }
+ for (auto v = variants.begin (); v != variants.end (); ++v) {
+ (*v)->unregister ();
+ }
+
+ m_pcells [id] = new pcell_header_type (id, name, declaration);
+
+ for (auto v = variants.begin (); v != variants.end (); ++v) {
+ (*v)->reregister ();
+ }
+
+ } else {
+ m_pcells [id] = new pcell_header_type (id, name, declaration);
+ }
} else {
diff --git a/src/edt/edt/edtServiceImpl.cc b/src/edt/edt/edtServiceImpl.cc
index dc3d2228c..669eb166f 100644
--- a/src/edt/edt/edtServiceImpl.cc
+++ b/src/edt/edt/edtServiceImpl.cc
@@ -40,6 +40,7 @@
#include "layLayoutViewBase.h"
#if defined(HAVE_QT)
+# include "layLayoutView.h"
# include "layTipDialog.h"
# include "layDragDropData.h"
#endif
@@ -72,6 +73,24 @@ ShapeEditService::configure (const std::string &name, const std::string &value)
}
}
+void
+ShapeEditService::activated ()
+{
+ edt::Service::activated ();
+
+#if defined(HAVE_QT)
+ if (view () == lay::LayoutView::current ()) {
+ lay::LayerPropertiesConstIterator cl = view ()->current_layer ();
+ if (! cl.is_null () && ! cl->visible (true)) {
+ lay::TipDialog td (QApplication::activeWindow (),
+ tl::to_string (tr ("You are about to draw on a hidden layer. The result won't be visible.")),
+ "drawing-on-invisible-layer");
+ td.exec_dialog ();
+ }
+ }
+#endif
+}
+
void
ShapeEditService::get_edit_layer ()
{
@@ -89,15 +108,6 @@ ShapeEditService::get_edit_layer ()
throw tl::Exception (tl::to_string (tr ("Please select a cell first")));
}
-#if defined(HAVE_QT)
- if (! cl->visible (true)) {
- lay::TipDialog td (QApplication::activeWindow (),
- tl::to_string (tr ("You are about to draw on a hidden layer. The result won't be visible.")),
- "drawing-on-invisible-layer");
- td.exec_dialog ();
- }
-#endif
-
if (layer < 0 || ! cv->layout ().is_valid_layer ((unsigned int) layer)) {
if (cl->has_children ()) {
diff --git a/src/edt/edt/edtServiceImpl.h b/src/edt/edt/edtServiceImpl.h
index e2c31ae5d..1015c993c 100644
--- a/src/edt/edt/edtServiceImpl.h
+++ b/src/edt/edt/edtServiceImpl.h
@@ -62,6 +62,7 @@ protected:
virtual void tap (const db::DPoint &initial);
virtual bool configure (const std::string &name, const std::string &value);
+ virtual void activated ();
protected:
std::pair interpolate (const db::DPoint &m, const db::DPoint &o, const db::DPoint &p) const;
diff --git a/src/klayout.pri b/src/klayout.pri
index b87ac9531..e7f90e037 100644
--- a/src/klayout.pri
+++ b/src/klayout.pri
@@ -118,6 +118,15 @@ equals(HAVE_GIT2, "1") {
DEFINES += HAVE_GIT2
}
+# Use the Address Sanitizer for the debug build on Mac
+mac {
+ USE_ASAN_MAC = $$system(echo $$(MAC_USE_ASAN))
+ equals(USE_ASAN_MAC, "1") {
+ QMAKE_CXXFLAGS += -fsanitize=address
+ QMAKE_LFLAGS += -fsanitize=address
+ }
+}
+
equals(HAVE_RUBY, "1") {
!isEmpty(BITS_PATH) {
include($$BITS_PATH/ruby/ruby.pri)
diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc
index 51bc51462..061fda5c6 100644
--- a/src/lay/lay/layMainWindow.cc
+++ b/src/lay/lay/layMainWindow.cc
@@ -188,6 +188,8 @@ MainWindow::MainWindow (QApplication *app, const char *name, bool undo_enabled)
mp_app (app),
m_manager (undo_enabled)
{
+ setAnimated (false);
+
m_dispatcher.set_menu_parent_widget (this);
m_dispatcher.make_menu ();
diff --git a/src/tl/tl/tlString.cc b/src/tl/tl/tlString.cc
index 8a0379e6e..d6bb80ede 100644
--- a/src/tl/tl/tlString.cc
+++ b/src/tl/tl/tlString.cc
@@ -226,9 +226,28 @@ bool skip_newline (const char *&cp)
}
}
+// -------------------------------------------------------------------------
+// Utility: case-insensitive compare of the first characters
+
+static bool local_compare (const char *s1, const char *s2)
+{
+ while (*s1 && *s2) {
+ uint32_t c1 = utf32_downcase (utf32_from_utf8 (s1));
+ uint32_t c2 = utf32_downcase (utf32_from_utf8 (s2));
+ if (c1 != c2) {
+ return false;
+ }
+ }
+ return true;
+}
+
// -------------------------------------------------------------------------
// Utility: a strtod version that is independent of the locale
+static std::string inf_string = "inf";
+static std::string ninf_string = "-inf";
+static std::string nan_string = "nan";
+
static std::string micron_format ("%.5f");
static std::string dbu_format ("%.2f");
@@ -244,12 +263,24 @@ void set_db_resolution (unsigned int ndigits)
std::string micron_to_string (double d)
{
- return tl::sprintf (micron_format.c_str (), d);
+ if (std::isnan (d)) {
+ return nan_string;
+ } else if (std::isinf (d)) {
+ return d < 0 ? ninf_string : inf_string;
+ } else {
+ return tl::sprintf (micron_format.c_str (), d);
+ }
}
std::string db_to_string (double d)
{
- return tl::sprintf (dbu_format.c_str (), d);
+ if (std::isnan (d)) {
+ return nan_string;
+ } else if (std::isinf (d)) {
+ return d < 0 ? ninf_string : inf_string;
+ } else {
+ return tl::sprintf (dbu_format.c_str (), d);
+ }
}
std::string to_upper_case (const std::string &s)
@@ -317,6 +348,18 @@ static double local_strtod (const char *cp, const char *&cp_new)
{
const char *cp0 = cp;
+ // special numerical values
+ if (local_compare (cp, nan_string.c_str ())) {
+ cp_new = cp + nan_string.size ();
+ return NAN;
+ } else if (local_compare (cp, inf_string.c_str ())) {
+ cp_new = cp + inf_string.size ();
+ return INFINITY;
+ } else if (local_compare (cp, ninf_string.c_str ())) {
+ cp_new = cp + ninf_string.size ();
+ return -INFINITY;
+ }
+
// Extract sign
double s = 1.0;
if (*cp == '-') {
@@ -376,6 +419,12 @@ static double local_strtod (const char *cp, const char *&cp_new)
std::string
to_string (double d, int prec)
{
+ if (std::isnan (d)) {
+ return nan_string;
+ } else if (std::isinf (d)) {
+ return d < 0 ? ninf_string : inf_string;
+ }
+
// For small values less than 1e-(prec) simply return "0" to avoid ugly values like "1.2321716e-14".
if (fabs (d) < pow (10.0, -prec)) {
return "0";
@@ -393,6 +442,12 @@ to_string (double d, int prec)
std::string
to_string (float d, int prec)
{
+ if (std::isnan (d)) {
+ return nan_string;
+ } else if (std::isinf (d)) {
+ return d < 0 ? ninf_string : inf_string;
+ }
+
// For small values less than 1e-(prec) simply return "0" to avoid ugly values like "1.2321716e-14".
if (fabs (d) < pow (10.0, -prec)) {
return "0";
@@ -813,6 +868,7 @@ from_string_numeric (const std::string &s, double &v, bool eval)
if (! *cp) {
throw tl::Exception (tl::to_string (tr ("Got empty string where a real number was expected")));
}
+
const char *cp_end = cp;
v = local_strtod (cp, cp_end);
while (safe_isspace (*cp_end)) {
diff --git a/src/tl/tl/tlVariant.cc b/src/tl/tl/tlVariant.cc
index 830c5d656..ced774fbc 100644
--- a/src/tl/tl/tlVariant.cc
+++ b/src/tl/tl/tlVariant.cc
@@ -1071,15 +1071,38 @@ normalized_type (Variant::type type1, Variant::type type2)
static const double epsilon = 1e-13;
+// NOTE: in order to be able to use Variant for std::map or std::set
+// keys we have to establish a weak order. This means we need to
+// consider NAN and INFINITY too.
+
+static int numeric_class (double x)
+{
+ if (std::isnan (x)) {
+ return 2;
+ } else {
+ return std::isinf (x) ? (x < 0 ? -1 : 1) : 0;
+ }
+}
+
static inline bool fequal (double a, double b)
{
- double avg = 0.5 * (fabs (a) + fabs (b));
- return fabs (a - b) <= epsilon * avg;
+ if (numeric_class (a) != 0 || numeric_class (b) != 0) {
+ return numeric_class (a) == numeric_class (b);
+ } else {
+ double avg = 0.5 * (fabs (a) + fabs (b));
+ return fabs (a - b) <= epsilon * avg;
+ }
}
static inline bool fless (double a, double b)
{
- return fequal (a, b) ? false : a < b;
+ if (fequal (a, b)) {
+ return false;
+ } else if (numeric_class (a) != 0 || numeric_class (b) != 0) {
+ return numeric_class (a) < numeric_class (b);
+ } else {
+ return a < b;
+ }
}
bool
diff --git a/src/tl/unit_tests/tlStringTests.cc b/src/tl/unit_tests/tlStringTests.cc
index aafab46e6..2c0e78386 100644
--- a/src/tl/unit_tests/tlStringTests.cc
+++ b/src/tl/unit_tests/tlStringTests.cc
@@ -589,3 +589,62 @@ TEST(15)
EXPECT_EQ (tl::to_upper_case ("nOrMaliI(\xc3\xa4\xc3\x84\xc3\xbc\xc3\x9c\xc3\xb6\xc3\x96\xc3\x9f-42\xc2\xb0+6\xe2\x82\xac)"), "NORMALII(\xc3\x84\xc3\x84\xc3\x9c\xc3\x9c\xc3\x96\xc3\x96\xc3\x9f-42\xc2\xb0+6\xe2\x82\xac)");
EXPECT_EQ (tl::to_lower_case ("nOrMaliI(\xc3\xa4\xc3\x84\xc3\xbc\xc3\x9c\xc3\xb6\xc3\x96\xc3\x9f-42\xc2\xb0+6\xe2\x82\xac)"), "normalii(\xc3\xa4\xc3\xa4\xc3\xbc\xc3\xbc\xc3\xb6\xc3\xb6\xc3\x9f-42\xc2\xb0+6\xe2\x82\xac)");
}
+
+// Special numerical values
+TEST(16)
+{
+ EXPECT_EQ (tl::to_string (NAN), "nan");
+ EXPECT_EQ (tl::to_string (INFINITY), "inf");
+ EXPECT_EQ (tl::to_string (-INFINITY), "-inf");
+
+ EXPECT_EQ (tl::to_string ((float) NAN), "nan");
+ EXPECT_EQ (tl::to_string ((float) INFINITY), "inf");
+ EXPECT_EQ (tl::to_string ((float) -INFINITY), "-inf");
+
+ EXPECT_EQ (tl::micron_to_string (NAN), "nan");
+ EXPECT_EQ (tl::micron_to_string (INFINITY), "inf");
+ EXPECT_EQ (tl::micron_to_string (-INFINITY), "-inf");
+
+ EXPECT_EQ (tl::db_to_string (NAN), "nan");
+ EXPECT_EQ (tl::db_to_string (INFINITY), "inf");
+ EXPECT_EQ (tl::db_to_string (-INFINITY), "-inf");
+
+ double x = 0.0;
+ tl::from_string ("nan", x);
+ EXPECT_EQ (tl::to_string (x), "nan");
+ x = 0.0;
+ tl::from_string ("NaN", x);
+ EXPECT_EQ (tl::to_string (x), "nan");
+ x = 0.0;
+ tl::from_string ("inf", x);
+ EXPECT_EQ (tl::to_string (x), "inf");
+ x = 0.0;
+ tl::from_string ("INF", x);
+ EXPECT_EQ (tl::to_string (x), "inf");
+ x = 0.0;
+ tl::from_string ("-inf", x);
+ EXPECT_EQ (tl::to_string (x), "-inf");
+ x = 0.0;
+ tl::from_string ("-INF", x);
+ EXPECT_EQ (tl::to_string (x), "-inf");
+
+ std::string s;
+ tl::Extractor ex;
+ x = 0.0;
+ s = " inf nan\t -inf";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (x), true);
+ EXPECT_EQ (tl::to_string (x), "inf");
+ EXPECT_EQ (ex.try_read (x), true);
+ EXPECT_EQ (tl::to_string (x), "nan");
+ EXPECT_EQ (ex.try_read (x), true);
+ EXPECT_EQ (tl::to_string (x), "-inf");
+ s = " Inf NaN\t -INF";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (x), true);
+ EXPECT_EQ (tl::to_string (x), "inf");
+ EXPECT_EQ (ex.try_read (x), true);
+ EXPECT_EQ (tl::to_string (x), "nan");
+ EXPECT_EQ (ex.try_read (x), true);
+ EXPECT_EQ (tl::to_string (x), "-inf");
+}
diff --git a/src/tl/unit_tests/tlVariantTests.cc b/src/tl/unit_tests/tlVariantTests.cc
index 9240a8339..58a7b0595 100644
--- a/src/tl/unit_tests/tlVariantTests.cc
+++ b/src/tl/unit_tests/tlVariantTests.cc
@@ -27,6 +27,8 @@
#include "tlObject.h"
#include "tlTypeTraits.h"
#include "tlUnitTest.h"
+
+#include
#include
#include
@@ -1166,4 +1168,110 @@ TEST(9)
EXPECT_EQ (tl::Variant (mi).to_parsable_string (), "{#-1=>#31,#17=>#42}");
}
+// special numeric values
+TEST(10)
+{
+ std::string s;
+ tl::Extractor ex;
+ tl::Variant v;
+
+ s = " ##\t 0.5";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##0.5");
+
+ s = "## nan";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##nan");
+
+ s = "## NaN";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##nan");
+
+ s = "## inf";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##inf");
+
+ s = "## Inf";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##inf");
+
+ s = "## -inf";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##-inf");
+
+ s = "## -Inf";
+ ex = tl::Extractor (s.c_str ());
+ EXPECT_EQ (ex.try_read (v), true);
+ EXPECT_EQ (v.to_parsable_string (), "##-inf");
+
+ v = tl::Variant ("nan");
+ v = tl::Variant (v.to_double ());
+ EXPECT_EQ (v.to_parsable_string (), "##nan");
+ EXPECT_EQ (v.to_string (), "nan");
+
+ v = tl::Variant ("Inf");
+ v = tl::Variant (v.to_double ());
+ EXPECT_EQ (v.to_parsable_string (), "##inf");
+ EXPECT_EQ (v.to_string (), "inf");
+
+ v = tl::Variant (INFINITY);
+ EXPECT_EQ (v.to_parsable_string (), "##inf");
+ EXPECT_EQ (v.to_string (), "inf");
+
+ v = tl::Variant (-INFINITY);
+ EXPECT_EQ (v.to_parsable_string (), "##-inf");
+ EXPECT_EQ (v.to_string (), "-inf");
+
+ tl::Variant vinf (INFINITY);
+ tl::Variant vninf (-INFINITY);
+ tl::Variant vnan (NAN);
+ tl::Variant vzero (0.0);
+
+ EXPECT_EQ (vninf == vninf, true);
+ EXPECT_EQ (vninf == vzero, false);
+ EXPECT_EQ (vninf == vinf, false);
+ EXPECT_EQ (vninf == vnan, false);
+
+ EXPECT_EQ (vninf < vninf, false);
+ EXPECT_EQ (vninf < vzero, true);
+ EXPECT_EQ (vninf < vinf, true);
+ EXPECT_EQ (vninf < vnan, true);
+
+ EXPECT_EQ (vzero == vninf, false);
+ EXPECT_EQ (vzero == vzero, true);
+ EXPECT_EQ (vzero == vinf, false);
+ EXPECT_EQ (vzero == vnan, false);
+
+ EXPECT_EQ (vzero < vninf, false);
+ EXPECT_EQ (vzero < vzero, false);
+ EXPECT_EQ (vzero < vinf, true);
+ EXPECT_EQ (vzero < vnan, true);
+
+ EXPECT_EQ (vinf == vninf, false);
+ EXPECT_EQ (vinf == vzero, false);
+ EXPECT_EQ (vinf == vinf, true);
+ EXPECT_EQ (vinf == vnan, false);
+
+ EXPECT_EQ (vinf < vninf, false);
+ EXPECT_EQ (vinf < vzero, false);
+ EXPECT_EQ (vinf < vinf, false);
+ EXPECT_EQ (vinf < vnan, true);
+
+ EXPECT_EQ (vnan == vninf, false);
+ EXPECT_EQ (vnan == vzero, false);
+ EXPECT_EQ (vnan == vinf, false);
+ EXPECT_EQ (vnan == vnan, true);
+
+ EXPECT_EQ (vnan < vninf, false);
+ EXPECT_EQ (vnan < vzero, false);
+ EXPECT_EQ (vnan < vinf, false);
+ EXPECT_EQ (vnan < vnan, false);
+}
+
}
diff --git a/testdata/ruby/dbPCells.rb b/testdata/ruby/dbPCells.rb
index 05422c3da..afbc7f2f2 100644
--- a/testdata/ruby/dbPCells.rb
+++ b/testdata/ruby/dbPCells.rb
@@ -674,6 +674,141 @@ class DBPCell_TestClass < TestBase
end
+ # issue #1782
+
+ class Circle1782 < RBA::PCellDeclarationHelper
+
+ def initialize
+ super()
+ param("l", TypeLayer, "Layer", :default => RBA::LayerInfo::new(1, 0))
+ param("r", TypeDouble, "Radius", :default => 1.0)
+ param("n", TypeInt, "Number of points", :default => 16)
+ end
+
+ def display_text_impl
+ r = self.r
+ if !r
+ r = "nil"
+ else
+ r = '%.3f' % r
+ end
+ "Circle(L=" + self.l.to_s + ",R=" + r + ")"
+ end
+
+ def produce_impl
+ r = self.r
+ if self.r.to_s == 'NaN'
+ r = 2.0
+ end
+ da = Math::PI * 2 / self.n
+ pts = self.n.times.collect do |i|
+ RBA::DPoint::new(r * Math::cos(i * da), r * Math::sin(i * da))
+ end
+ self.cell.shapes(self.l_layer).insert(RBA::DPolygon::new(pts))
+ end
+
+ end
+
+ class CircleLib1782 < RBA::Library
+
+ def initialize(name)
+ self.description = "Circle Library"
+ self.layout.register_pcell("Circle", Circle1782::new)
+ register(name)
+ end
+
+ def reregister_pcell
+ self.layout.register_pcell("Circle", Circle1782::new)
+ end
+
+ end
+
+ def test_10
+
+ lib = CircleLib1782::new("CircleLib")
+
+ ly = RBA::Layout::new
+
+ top = ly.create_cell("TOP")
+
+ names = []
+
+ 2.times do |pass|
+
+ 5.times do |i|
+ 5.times do |j|
+ if (i + j) % 2 == 0
+ r = Float::NAN
+ else
+ r = (i + j) * 0.5
+ end
+ n = i * 5 + j
+ c = ly.create_cell("Circle", "CircleLib", { "l" => RBA::LayerInfo::new(1, 0), "r" => r, "n" => n })
+ if pass == 0
+ names << c.name
+ else
+ # triggered bug #1782 - basically all variants are supposed to be unique, but
+ # the NaN spoiled the hash maps
+ assert_equal(names.shift, c.name)
+ end
+ top.insert(RBA::DCellInstArray::new(c, RBA::DTrans::new(i * 10.0, j * 10.0)))
+ end
+ end
+
+ end
+
+ tmp = File::join($ut_testtmp, "tmp.gds")
+ ly.write(tmp)
+
+ # this should not throw an internal error
+ ly._destroy
+
+ # we should be able to read the Layout back
+ ly = RBA::Layout::new
+ ly.read(tmp)
+ assert_equal(ly.top_cell.name, "TOP")
+ assert_equal(ly.cells, 26)
+ ly._destroy
+
+ lib._destroy
+
+ end
+
+ def test_11
+
+ lib = CircleLib1782::new("CircleLib")
+
+ ly = RBA::Layout::new
+
+ top = ly.create_cell("TOP")
+
+ names = []
+
+ c = ly.create_cell("Circle", "CircleLib", { "l" => RBA::LayerInfo::new(1, 0), "r" => 2.0, "n" => 64 })
+
+ # triggered another flavor of #1782
+ lib.reregister_pcell
+
+ c = ly.create_cell("Circle", "CircleLib", { "l" => RBA::LayerInfo::new(1, 0), "r" => 2.0, "n" => 64 })
+ top.insert(RBA::DCellInstArray::new(c, RBA::DTrans::new()))
+
+ tmp = File::join($ut_testtmp, "tmp.gds")
+ ly.write(tmp)
+
+ # this should not throw an internal error
+ ly._destroy
+
+ # we should be able to read the Layout back
+ ly = RBA::Layout::new
+ ly.read(tmp)
+ assert_equal(ly.top_cell.name, "TOP")
+ assert_equal(ly.cells, 2)
+ ly._destroy
+
+ lib._destroy
+
+ end
+
end
load("test_epilogue.rb")