587
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
2 |
<!--
|
|
3 |
============================================================================
|
|
4 |
Name : build.xml
|
|
5 |
Part of : Helium AntLib
|
|
6 |
|
|
7 |
Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
8 |
All rights reserved.
|
|
9 |
This component and the accompanying materials are made available
|
|
10 |
under the terms of the License "Eclipse Public License v1.0"
|
|
11 |
which accompanies this distribution, and is available
|
|
12 |
at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
13 |
|
|
14 |
Initial Contributors:
|
|
15 |
Nokia Corporation - initial contribution.
|
|
16 |
|
|
17 |
Contributors:
|
|
18 |
|
|
19 |
Description:
|
|
20 |
|
|
21 |
============================================================================
|
|
22 |
-->
|
|
23 |
<project name="test-recorder" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
|
|
24 |
<description>Helium Antlib logger unittests.</description>
|
|
25 |
|
|
26 |
<target name="test-recorder">
|
|
27 |
<echo message="something to be not be recorded" />
|
|
28 |
<hlm:record name="${temp.dir}/record.log" action="start" />
|
|
29 |
<echo message="something to be recorded" />
|
|
30 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
31 |
<echo message="something to be not be recorded" />
|
|
32 |
|
|
33 |
<loadfile property="message" srcFile="${temp.dir}/record.log" />
|
|
34 |
<au:assertTrue message="message not recorded">
|
|
35 |
<contains string="${message}" substring="something to be recorded" />
|
|
36 |
</au:assertTrue>
|
|
37 |
</target>
|
|
38 |
|
|
39 |
<target name="test-recorder-backup">
|
|
40 |
<echo message="something to be not be recorded" />
|
|
41 |
<hlm:record name="${temp.dir}/record.log" action="start" />
|
|
42 |
<echo message="something to be recorded 1st" />
|
|
43 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
44 |
|
|
45 |
<echo message="something to be not be recorded" />
|
|
46 |
<hlm:record name="${temp.dir}/record.log" action="start" backup="true" />
|
|
47 |
<echo message="something to be recorded 2nd" />
|
|
48 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
49 |
|
|
50 |
<echo message="something to be not be recorded" />
|
|
51 |
<hlm:record name="${temp.dir}/record.log" action="start" backup="true" backupProperty="backup.log"/>
|
|
52 |
<echo message="something to be recorded 3rd" />
|
|
53 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
54 |
<echo message="something to be not be recorded" />
|
|
55 |
|
|
56 |
<au:assertFileExists file="${backup.log}" />
|
|
57 |
<au:assertFileExists file="${temp.dir}/record.log" />
|
|
58 |
<loadfile property="message" srcFile="${temp.dir}/record.log" />
|
|
59 |
<au:assertTrue message="3rd message should be recorded">
|
|
60 |
<contains string="${message}" substring="something to be recorded 3rd" />
|
|
61 |
</au:assertTrue>
|
|
62 |
<au:assertFalse message="1st message should not be recorded">
|
|
63 |
<contains string="${message}" substring="something to be recorded 1st" />
|
|
64 |
</au:assertFalse>
|
|
65 |
<au:assertFalse message="2nd message should not be recorded">
|
|
66 |
<contains string="${message}" substring="something to be recorded 2nd" />
|
|
67 |
</au:assertFalse>
|
|
68 |
</target>
|
|
69 |
|
|
70 |
<target name="test-recorder-append">
|
|
71 |
<echo message="something to be not be recorded" />
|
|
72 |
<hlm:record name="${temp.dir}/record.log" action="start" />
|
|
73 |
<echo message="something to be recorded" />
|
|
74 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
75 |
<echo message="something to be not be recorded" />
|
|
76 |
<hlm:record name="${temp.dir}/record.log" action="start" append="true" />
|
|
77 |
<echo message="something else to be recorded" />
|
|
78 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
79 |
<echo message="something to be not be recorded" />
|
|
80 |
|
|
81 |
<loadfile property="message" srcFile="${temp.dir}/record.log" />
|
|
82 |
<au:assertTrue message="message not recorded">
|
|
83 |
<contains string="${message}" substring="something to be recorded" />
|
|
84 |
</au:assertTrue>
|
|
85 |
<au:assertTrue message="second message not recorded">
|
|
86 |
<contains string="${message}" substring="something else to be recorded" />
|
|
87 |
</au:assertTrue>
|
|
88 |
</target>
|
|
89 |
|
|
90 |
<target name="antcall-record">
|
|
91 |
<hlm:record name="${temp.dir}/record.log" action="start" append="true" />
|
|
92 |
<echo message="${message}" />
|
|
93 |
<hlm:record name="${temp.dir}/record.log" action="stop" />
|
|
94 |
</target>
|
|
95 |
|
|
96 |
<target name="test-recorder-append-antcall">
|
|
97 |
<echo message="Antcall: something to be not be recorded" />
|
|
98 |
<antcall target="antcall-record">
|
|
99 |
<param name="message" value="something to be recorded" />
|
|
100 |
</antcall>
|
|
101 |
<echo message="Antcall: something to be not be recorded" />
|
|
102 |
<antcall target="antcall-record">
|
|
103 |
<param name="message" value="something else to be recorded" />
|
|
104 |
</antcall>
|
|
105 |
<echo message="Antcall: something to be not be recorded" />
|
|
106 |
|
|
107 |
<loadfile property="message" srcFile="${temp.dir}/record.log" />
|
|
108 |
<echo>${message}</echo>
|
|
109 |
<au:assertTrue message="Antcall: message not recorded">
|
|
110 |
<contains string="${message}" substring="something to be recorded" />
|
|
111 |
</au:assertTrue>
|
|
112 |
<au:assertTrue message="Antcall: second message not recorded">
|
|
113 |
<contains string="${message}" substring="something else to be recorded" />
|
|
114 |
</au:assertTrue>
|
|
115 |
</target>
|
|
116 |
|
|
117 |
<target name="test-recorder-filtering">
|
|
118 |
<hlm:record name="${temp.dir}/record.log" action="start" >
|
|
119 |
<hlm:recordfilter category="unix" regexp="badtext" />
|
|
120 |
</hlm:record>
|
|
121 |
<echo>Some sensitive test output badtext</echo>
|
|
122 |
<hlm:record name="${temp.dir}/record.log" action="stop"/>
|
|
123 |
<loadfile srcfile="${temp.dir}/record.log" property="message"/>
|
|
124 |
<au:assertTrue>
|
|
125 |
<contains string="${message}" substring="Some sensitive test output ********"/>
|
|
126 |
</au:assertTrue>
|
|
127 |
</target>
|
|
128 |
|
|
129 |
</project>
|