|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 import sys, os, unittest |
|
18 import __init__ |
|
19 |
|
20 ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) |
|
21 |
|
22 from testautomation.base_testcase import BaseTestCase |
|
23 from cone.public import exceptions, plugin, api, container |
|
24 |
|
25 from CRMLPlugin import crml_impl |
|
26 |
|
27 def abspath(path): |
|
28 return os.path.normpath(os.path.join(ROOT_PATH, path)) |
|
29 |
|
30 class TestCrmlImpl(BaseTestCase): |
|
31 |
|
32 def test_generate_from_project_with_rfs(self): |
|
33 project_dir = abspath('gen_project') |
|
34 config = 'root.confml' |
|
35 output_dir = abspath('temp/gen_output1') |
|
36 expected_dir = abspath('gen_expected') |
|
37 |
|
38 self.remove_if_exists(output_dir) |
|
39 |
|
40 prj = api.Project(api.Storage.open(project_dir)) |
|
41 config = prj.get_configuration(config) |
|
42 impls = plugin.get_impl_set(config, 'crml$') |
|
43 impls.output = output_dir |
|
44 impls.generation_context.tags['target'] = ['rofs2'] |
|
45 impls.generate() |
|
46 impls.post_generate() |
|
47 |
|
48 self.assert_dir_contents_equal(output_dir, expected_dir, ['.svn']) |
|
49 |
|
50 def test_generate_from_project_without_rfs(self): |
|
51 project_dir = abspath('gen_project') |
|
52 config = 'root.confml' |
|
53 output_dir = abspath('temp/gen_output2') |
|
54 expected_dir = abspath('gen_expected') |
|
55 |
|
56 self.remove_if_exists(output_dir) |
|
57 |
|
58 prj = api.Project(api.Storage.open(project_dir)) |
|
59 config = prj.get_configuration(config) |
|
60 impls = plugin.get_impl_set(config, 'crml$') |
|
61 impls.output = output_dir |
|
62 impls.generation_context.tags['target'] = [] |
|
63 impls.generate() |
|
64 impls.post_generate() |
|
65 |
|
66 self.assert_dir_contents_equal(output_dir, expected_dir, ['.svn', 'private']) |
|
67 self.assertFalse(os.path.exists(os.path.join(output_dir, 'private/100059C9/cenrep_rfs.txt'))) |
|
68 |
|
69 |
|
70 def test_generate_from_project_duplicate_rfs(self): |
|
71 project_dir = abspath('duplicate_rfs_project') |
|
72 config = 'root.confml' |
|
73 output_dir = abspath('temp/duplicate_rfs_output') |
|
74 expected_dir = abspath('duplicate_rfs_expected') |
|
75 |
|
76 self.remove_if_exists(output_dir) |
|
77 |
|
78 prj = api.Project(api.Storage.open(project_dir)) |
|
79 config = prj.get_configuration(config) |
|
80 impls = plugin.get_impl_set(config, 'crml$') |
|
81 impls.output = output_dir |
|
82 impls.generation_context.tags['target'] = ['rofs2'] |
|
83 impls.generate() |
|
84 impls.post_generate() |
|
85 |
|
86 self.assert_dir_contents_equal(output_dir, expected_dir, ['.svn']) |
|
87 |