diff -r 000000000000 -r 2e8eeb919028 configurationengine/source/plugins/symbian/integration-test/unittest_crml_dc.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configurationengine/source/plugins/symbian/integration-test/unittest_crml_dc.py Thu Mar 11 17:04:37 2010 +0200 @@ -0,0 +1,189 @@ +# *-* coding: utf-8 *-* +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# +## +# @author Teemu Rytkonen + +import sys, os, shutil, unittest +import __init__ +from testautomation.base_testcase import BaseTestCase + +ROOT_PATH = os.path.abspath(os.path.dirname(__file__)) +TEMP_DIR = os.path.normpath(os.path.join(ROOT_PATH, 'temp/crml_dc')) + +if sys.platform == "win32": + CONE_SCRIPT = "cone.cmd" +else: + CONE_SCRIPT = "cone.sh" + +def get_cmd(action='compare'): + """Return the command used to run the ConE sub-action""" + if 'CONE_PATH' in os.environ: + CONE_CMD = os.path.join(os.environ['CONE_PATH'], CONE_SCRIPT) + if not os.path.exists(CONE_CMD): + raise RuntimeError("'%s' does not exist!" % CONE_CMD) + return '"%s" %s' % (CONE_CMD, action) + else: + SOURCE_ROOT = os.path.normpath(os.path.join(ROOT_PATH, '../../..')) + assert os.path.split(SOURCE_ROOT)[1] == 'source' + cmd = 'python "%s" %s' % (os.path.normpath(os.path.join(SOURCE_ROOT, 'scripts/cone_tool.py')), action) + return cmd + +def get_crml_dc_testdata_dir(): + # If running from the working copy + dir1 = os.path.normpath(os.path.join(ROOT_PATH, '../ConeCRMLPlugin/CRMLPlugin/tests')) + if os.path.isdir(dir1): return dir1 + + # If running from standalone + dir2 = os.path.normpath(os.path.join(ROOT_PATH, 'testdata/compare/crml_dc')) + if os.path.isdir(dir2): return dir2 + + raise RuntimeError("CRML DC test data found neither in '%s' nor '%s'!" % (dir1, dir2)) + + +class TestCompareAction(BaseTestCase): + + def setUp(self): + if not os.path.exists(TEMP_DIR): + os.makedirs(TEMP_DIR) + + def _run_crml_dc_test(self, crml_file_name_without_extension, do_filtering=True): + testdata_dir = get_crml_dc_testdata_dir() + report_file = 'crml_dc_%s.csv' % crml_file_name_without_extension + if do_filtering: + impl_filter = '%s' % crml_file_name_without_extension + else: + impl_filter = '.*' + self._run_comparison_test( + source_project = os.path.join(testdata_dir, 'comp_project_1'), + source_conf = 'root.confml', + target_project = os.path.join(testdata_dir, 'comp_project_2'), + target_conf = 'root.confml', + report_type = 'crml_dc_csv', + report_file = report_file, + impl_filter = impl_filter, + check_against_expected_output = True) + + def test_crml_dc_00000001_simple_keys(self): self._run_crml_dc_test('00000001_simple_keys') + def test_crml_dc_00000002_bitmask_keys(self): self._run_crml_dc_test('00000002_bitmask_keys') + def test_crml_dc_00000003_key_ranges(self): self._run_crml_dc_test('00000003_key_ranges') + def test_crml_dc_00000004_key_type_changed(self): self._run_crml_dc_test('00000004_key_type_changed') + def test_crml_dc_00000005_repo_attrs_changed(self): self._run_crml_dc_test('00000005_repo_attrs_changed') + def test_crml_dc_10000001_removed_repo(self): self._run_crml_dc_test('10000001_removed_repo') + def test_crml_dc_20000001_added_repo(self): self._run_crml_dc_test('20000001_added_repo') + def test_crml_dc_00000006_renamed_repo(self): self._run_crml_dc_test('00000006_renamed_repo') + def test_crml_dc_30000000_duplicate_repo(self): self._run_crml_dc_test('30000000_duplicate_repo') + def test_crml_dc_all(self): self._run_crml_dc_test('all', do_filtering=False) + + def test_crml_dc_html_report(self): + testdata_dir = get_crml_dc_testdata_dir() + + # Ignore the portion of the data where the path to the target is shown + ignore_patterns = [r'