From 9449236cf7bf48f40b696edce68d81410d713489 Mon Sep 17 00:00:00 2001
From: Martin Braun <martin.braun@ettus.com>
Date: Sun, 7 Oct 2018 13:30:35 -0700
Subject: modtool: OOTs use Boost.UTF, CMake 3.8-Aware

- This is the same change that happened for the GNU Radio core
- New OOTs will now have Boost.UTF-based unit tests
- modtool will be able to handle both CppUnit-based OOTs as well as
  Boost.UTF-based ones; this change is backward-compatible
---
 gr-utils/python/modtool/modtool_add.py | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

(limited to 'gr-utils/python/modtool/modtool_add.py')

diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py
index 2ff5a9ad30..9f128d2fde 100644
--- a/gr-utils/python/modtool/modtool_add.py
+++ b/gr-utils/python/modtool/modtool_add.py
@@ -1,5 +1,5 @@
 #
-# Copyright 2013, 2017 Free Software Foundation, Inc.
+# Copyright 2013, 2017-2018 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -230,9 +230,27 @@ class ModToolAdd(ModTool):
                     self.scm.mark_files_updated((self._file['qalib'],))
                 except IOError:
                     print("Can't add C++ QA files.")
+        def _add_qa_boostutf():
+            " Add C++ QA files for 3.8 API "
+            fname_qa_cc = 'qa_%s.cc' % self._info['blockname']
+            self._write_tpl('qa_cpp_boostutf', 'lib', fname_qa_cc)
+            if not self._skip_cmakefiles:
+                try:
+                    ed = CMakeFileEditor(self._file['cmlib'])
+                    cmake_list_var = \
+                        'test_{}_source'.format(self._info['modname'])
+                    if not ed.append_value(
+                            'list',
+                            fname_qa_cc,
+                            to_ignore_start='APPEND ' + cmake_list_var):
+                        print("Couldn't add C++ QA files.")
+                    ed.write()
+                    self.scm.mark_files_updated((self._file['cmlib'],))
+                except IOError:
+                    print("Can't add C++ QA files.")
         fname_cc = None
         fname_h = None
-        if self._info['version'] == '37':
+        if self._info['version'] in ('37', '38'):
             fname_h = self._info['blockname'] + '.h'
             fname_cc = self._info['blockname'] + '.cc'
             if self._info['blocktype'] in ('source', 'sink', 'sync', 'decimator',
@@ -249,6 +267,8 @@ class ModToolAdd(ModTool):
         if self._add_cc_qa:
             if self._info['version'] == '37':
                 _add_qa()
+            if self._info['version'] == '38':
+                _add_qa_boostutf()
             elif self._info['version'] == '36':
                 print("Warning: C++ QA files not supported for 3.6-style OOTs.")
             elif self._info['version'] == 'autofoo':
-- 
cgit v1.2.3