configurationengine/source/plugins/symbian/integration-test/unittest_crml_dc.py
author terytkon
Thu, 11 Mar 2010 17:04:37 +0200
changeset 0 2e8eeb919028
child 3 e7e0ae78773e
permissions -rw-r--r--
Adding EPL version of configurationengine.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     1
# *-* coding: utf-8 *-*
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     2
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     3
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     4
# All rights reserved.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     5
# This component and the accompanying materials are made available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     6
# under the terms of "Eclipse Public License v1.0"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     7
# which accompanies this distribution, and is available
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     8
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
     9
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    10
# Initial Contributors:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    11
# Nokia Corporation - initial contribution.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    12
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    13
# Contributors:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    14
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    15
# Description:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    16
#
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    17
## 
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    18
# @author Teemu Rytkonen
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    19
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    20
import sys, os, shutil, unittest
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    21
import __init__
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    22
from testautomation.base_testcase import BaseTestCase
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    23
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    24
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    25
TEMP_DIR        = os.path.normpath(os.path.join(ROOT_PATH, 'temp/crml_dc'))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    26
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    27
if sys.platform == "win32":
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    28
    CONE_SCRIPT = "cone.cmd"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    29
else:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    30
    CONE_SCRIPT = "cone.sh"
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    31
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    32
def get_cmd(action='compare'):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    33
    """Return the command used to run the ConE sub-action"""
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    34
    if 'CONE_PATH' in os.environ:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    35
        CONE_CMD = os.path.join(os.environ['CONE_PATH'], CONE_SCRIPT)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    36
        if not os.path.exists(CONE_CMD):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    37
            raise RuntimeError("'%s' does not exist!" % CONE_CMD)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    38
        return '"%s" %s' % (CONE_CMD, action)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    39
    else:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    40
        SOURCE_ROOT = os.path.normpath(os.path.join(ROOT_PATH, '../../..'))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    41
        assert os.path.split(SOURCE_ROOT)[1] == 'source'
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    42
        cmd = 'python "%s" %s' % (os.path.normpath(os.path.join(SOURCE_ROOT, 'scripts/cone_tool.py')), action)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    43
        return cmd
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    44
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    45
def get_crml_dc_testdata_dir():
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    46
    # If running from the working copy
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    47
    dir1 = os.path.normpath(os.path.join(ROOT_PATH, '../ConeCRMLPlugin/CRMLPlugin/tests'))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    48
    if os.path.isdir(dir1): return dir1
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    49
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    50
    # If running from standalone
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    51
    dir2 = os.path.normpath(os.path.join(ROOT_PATH, 'testdata/compare/crml_dc'))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    52
    if os.path.isdir(dir2): return dir2
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    53
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    54
    raise RuntimeError("CRML DC test data found neither in '%s' nor '%s'!" % (dir1, dir2))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    55
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    56
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    57
class TestCompareAction(BaseTestCase):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    58
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    59
    def setUp(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    60
        if not os.path.exists(TEMP_DIR):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    61
            os.makedirs(TEMP_DIR)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    62
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    63
    def _run_crml_dc_test(self, crml_file_name_without_extension, do_filtering=True):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    64
        testdata_dir = get_crml_dc_testdata_dir()
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    65
        report_file = 'crml_dc_%s.csv' % crml_file_name_without_extension
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    66
        if do_filtering:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    67
            impl_filter = '%s' % crml_file_name_without_extension
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    68
        else:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    69
            impl_filter = '.*'
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    70
        self._run_comparison_test(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    71
            source_project  = os.path.join(testdata_dir, 'comp_project_1'),
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    72
            source_conf     = 'root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    73
            target_project  = os.path.join(testdata_dir, 'comp_project_2'),
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    74
            target_conf     = 'root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    75
            report_type     = 'crml_dc_csv',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    76
            report_file     = report_file,
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    77
            impl_filter     = impl_filter,
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    78
            check_against_expected_output = True)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    79
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    80
    def test_crml_dc_00000001_simple_keys(self):        self._run_crml_dc_test('00000001_simple_keys')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    81
    def test_crml_dc_00000002_bitmask_keys(self):       self._run_crml_dc_test('00000002_bitmask_keys')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    82
    def test_crml_dc_00000003_key_ranges(self):         self._run_crml_dc_test('00000003_key_ranges')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    83
    def test_crml_dc_00000004_key_type_changed(self):   self._run_crml_dc_test('00000004_key_type_changed')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    84
    def test_crml_dc_00000005_repo_attrs_changed(self): self._run_crml_dc_test('00000005_repo_attrs_changed')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    85
    def test_crml_dc_10000001_removed_repo(self):       self._run_crml_dc_test('10000001_removed_repo')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    86
    def test_crml_dc_20000001_added_repo(self):         self._run_crml_dc_test('20000001_added_repo')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    87
    def test_crml_dc_00000006_renamed_repo(self):       self._run_crml_dc_test('00000006_renamed_repo')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    88
    def test_crml_dc_30000000_duplicate_repo(self):     self._run_crml_dc_test('30000000_duplicate_repo')
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    89
    def test_crml_dc_all(self):                         self._run_crml_dc_test('all', do_filtering=False)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    90
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    91
    def test_crml_dc_html_report(self):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    92
        testdata_dir = get_crml_dc_testdata_dir()
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    93
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    94
        # Ignore the portion of the data where the path to the target is shown
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    95
        ignore_patterns = [r'<tr>\s*<td>Target:</td>\s*<td>.*[\\,/]comp_project_2;root.confml</td>']
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    96
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    97
        self._run_comparison_test(
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    98
            source_project  = os.path.join(testdata_dir, 'comp_project_1'),
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
    99
            source_conf     = 'root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   100
            target_project  = os.path.join(testdata_dir, 'comp_project_2'),
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   101
            target_conf     = 'root.confml',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   102
            report_type     = 'crml_dc',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   103
            report_file     = 'crml_dc.html',
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   104
            check_against_expected_output = True,
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   105
            data_ignore_patterns = ignore_patterns)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   106
    
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   107
    def _run_comparison_test(self, **kwargs):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   108
        """
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   109
        Run comparison test.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   110
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   111
        @param source_project: The source project, relative to the test data directory or an
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   112
            absolute path.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   113
        @param source_conf: The source configuration.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   114
        @param target_project: The target project, relative to the test data directory
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   115
            If not given or None, the source project will be used also for this.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   116
        @param target_conf: The target configuration.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   117
        @param template: The template file used for the report, relative to the test data directory.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   118
        @param report_type: The report type. Should not be used with the 'template' parameter.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   119
        @param report_file: The location where the report is written. This will also be used as
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   120
            the name of the expected report file against which the actual report is checked.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   121
        @param impl_filter: Implementation filter to use.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   122
        @param check_against_expected_output: If True, the actual report is checked against an
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   123
            expected file with the same name. Otherwise it is just checked that the output
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   124
            file has been created and it contains something.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   125
        @param data_ignore_patterns: List of regular expression patterns for ignoring some portions
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   126
            of the data when checking against expected output. The patterns are used to remove
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   127
            data portions before doing the actual comparison.
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   128
        """
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   129
        # Get parameters
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   130
        # ---------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   131
        def get_project_absdir(project_dir):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   132
            if os.path.isabs(project_dir):
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   133
                return project_dir
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   134
            else:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   135
                return os.path.normpath(os.path.join(TESTDATA_DIR, project_dir))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   136
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   137
        source_conf = kwargs['source_conf']
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   138
        target_conf = kwargs['target_conf']
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   139
        source_project = get_project_absdir(kwargs['source_project'])
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   140
        target_project = kwargs.get('target_project', None)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   141
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   142
        if target_project != None:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   143
            target_project = get_project_absdir(target_project)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   144
            target_conf = target_project + ';' + target_conf
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   145
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   146
        template = kwargs.get('template', None)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   147
        report_type = kwargs.get('report_type', None)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   148
        if template and report_type:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   149
            raise ValueError("Both 'template' and 'report_type' parameters given")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   150
        elif not template and not report_type:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   151
            raise ValueError("Neither 'template' not 'report_type' parameter given")
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   152
        elif template:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   153
            template = os.path.normpath(os.path.join(TESTDATA_DIR, template))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   154
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   155
        report_file = kwargs['report_file']
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   156
        check_against_expected_output = kwargs['check_against_expected_output']
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   157
        actual_report = os.path.normpath(os.path.join(TEMP_DIR, report_file))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   158
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   159
        impl_filter = kwargs.get('impl_filter', None)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   160
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   161
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   162
        # Generate output
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   163
        # ----------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   164
        if report_type:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   165
            command = '%s -p "%s" -s "%s" -t "%s" --report-type "%s" --report "%s"' \
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   166
                % (get_cmd(), source_project, source_conf, target_conf, report_type, actual_report)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   167
        else:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   168
            command = '%s -p "%s" -s "%s" -t "%s" --template "%s" --report "%s"' \
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   169
                % (get_cmd(), source_project, source_conf, target_conf, template, actual_report)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   170
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   171
        if impl_filter:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   172
            command += ' --impl-filter "%s"' % impl_filter
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   173
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   174
        self.remove_if_exists(actual_report)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   175
        self.run_command(command)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   176
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   177
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   178
        # Check output
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   179
        # -------------
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   180
        if check_against_expected_output:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   181
            expected_report = os.path.normpath(os.path.join(ROOT_PATH, 'testdata/crml_dc_expected', report_file))
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   182
            ignore_patterns = kwargs.get('data_ignore_patterns', [])
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   183
            self.assert_file_contents_equal(expected_report, actual_report, ignore_patterns)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   184
        else:
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   185
            self.assert_exists_and_contains_something(actual_report)
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   186
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   187
        
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   188
if __name__ == '__main__':
2e8eeb919028 Adding EPL version of configurationengine.
terytkon
parents:
diff changeset
   189
      unittest.main()