doc: whitespace changes in licenses
[dpdk.git] / scripts / test-framework.sh
1 #!/bin/sh
2
3 #   BSD LICENSE
4
5 #   Copyright(c) 2010-2013 Intel Corporation. All rights reserved.
6 #   All rights reserved.
7
8 #   Redistribution and use in source and binary forms, with or without
9 #   modification, are permitted provided that the following conditions
10 #   are met:
11
12 #     * Redistributions of source code must retain the above copyright
13 #       notice, this list of conditions and the following disclaimer.
14 #     * Redistributions in binary form must reproduce the above copyright
15 #       notice, this list of conditions and the following disclaimer in
16 #       the documentation and/or other materials provided with the
17 #       distribution.
18 #     * Neither the name of Intel Corporation nor the names of its
19 #       contributors may be used to endorse or promote products derived
20 #       from this software without specific prior written permission.
21
22 #   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 #   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 #   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 #   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 #   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 #   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 #   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 #   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 #   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 #   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 #   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 # script to check that dependancies are working in the framework
35 # must be executed from root
36
37 # do a first build
38 make config T=x86_64-default-linuxapp-gcc O=deptest
39 make -j8 O=deptest
40
41 MOD_APP_TEST1=`stat deptest/app/test | grep Modify`
42 MOD_APP_TEST_MEMPOOL1=`stat deptest/build/app/test/test_mempool.o | grep Modify`
43 MOD_LIB_MEMPOOL1=`stat deptest/lib/librte_mempool.a | grep Modify`
44 MOD_LIB_MBUF1=`stat deptest/lib/librte_mbuf.a | grep Modify`
45
46 echo "----- touch mempool.c, and check that deps are updated"
47 sleep 1
48 touch lib/librte_mempool/rte_mempool.c
49 make -j8 O=deptest
50
51 MOD_APP_TEST2=`stat deptest/app/test | grep Modify`
52 MOD_APP_TEST_MEMPOOL2=`stat deptest/build/app/test/test_mempool.o | grep Modify`
53 MOD_LIB_MEMPOOL2=`stat deptest/lib/librte_mempool.a | grep Modify`
54 MOD_LIB_MBUF2=`stat deptest/lib/librte_mbuf.a | grep Modify`
55
56 if [ "${MOD_APP_TEST1}" = "${MOD_APP_TEST2}" ]; then
57         echo ${MOD_APP_TEST1} / ${MOD_APP_TEST2}
58         echo "Bad deps on deptest/app/test"
59         exit 1
60 fi
61 if [ "${MOD_APP_TEST_MEMPOOL1}" != "${MOD_APP_TEST_MEMPOOL2}" ]; then
62         echo "Bad deps on deptest/build/app/test/test_mempool.o"
63         exit 1
64 fi
65 if [ "${MOD_LIB_MEMPOOL1}" = "${MOD_LIB_MEMPOOL2}" ]; then
66         echo "Bad deps on deptest/lib/librte_mempool.a"
67         exit 1
68 fi
69 if [ "${MOD_LIB_MBUF1}" != "${MOD_LIB_MBUF2}" ]; then
70         echo "Bad deps on deptest/lib/librte_mbuf.a"
71         exit 1
72 fi
73
74 echo "----- touch mempool.h, and check that deps are updated"
75 sleep 1
76 touch lib/librte_mempool/rte_mempool.h
77 make -j8 O=deptest
78
79 MOD_APP_TEST3=`stat deptest/app/test | grep Modify`
80 MOD_APP_TEST_MEMPOOL3=`stat deptest/build/app/test/test_mempool.o | grep Modify`
81 MOD_LIB_MEMPOOL3=`stat deptest/lib/librte_mempool.a | grep Modify`
82 MOD_LIB_MBUF3=`stat deptest/lib/librte_mbuf.a | grep Modify`
83
84 if [ "${MOD_APP_TEST2}" = "${MOD_APP_TEST3}" ]; then
85         echo "Bad deps on deptest/app/test"
86         exit 1
87 fi
88 if [ "${MOD_APP_TEST_MEMPOOL2}" = "${MOD_APP_TEST_MEMPOOL3}" ]; then
89         echo "Bad deps on deptest/build/app/test/test_mempool.o"
90         exit 1
91 fi
92 if [ "${MOD_LIB_MEMPOOL2}" = "${MOD_LIB_MEMPOOL3}" ]; then
93         echo "Bad deps on deptest/lib/librte_mempool.a"
94         exit 1
95 fi
96 if [ "${MOD_LIB_MBUF2}" = "${MOD_LIB_MBUF3}" ]; then
97         echo "Bad deps on deptest/lib/librte_mbuf.a"
98         exit 1
99 fi
100
101
102 echo "----- change mempool.c's CFLAGS, and check that deps are updated"
103 sleep 1
104 make -j8 O=deptest CFLAGS_rte_mempool.o="-DDUMMY_TEST"
105
106 MOD_APP_TEST4=`stat deptest/app/test | grep Modify`
107 MOD_APP_TEST_MEMPOOL4=`stat deptest/build/app/test/test_mempool.o | grep Modify`
108 MOD_LIB_MEMPOOL4=`stat deptest/lib/librte_mempool.a | grep Modify`
109 MOD_LIB_MBUF4=`stat deptest/lib/librte_mbuf.a | grep Modify`
110
111 if [ "${MOD_APP_TEST3}" = "${MOD_APP_TEST4}" ]; then
112         echo "Bad deps on deptest/app/test"
113         exit 1
114 fi
115 if [ "${MOD_APP_TEST_MEMPOOL3}" != "${MOD_APP_TEST_MEMPOOL4}" ]; then
116         echo "Bad deps on deptest/build/app/test/test_mempool.o"
117         exit 1
118 fi
119 if [ "${MOD_LIB_MEMPOOL3}" = "${MOD_LIB_MEMPOOL4}" ]; then
120         echo "Bad deps on deptest/lib/librte_mempool.a"
121         exit 1
122 fi
123 if [ "${MOD_LIB_MBUF3}" != "${MOD_LIB_MBUF4}" ]; then
124         echo "Bad deps on deptest/lib/librte_mbuf.a"
125         exit 1
126 fi
127
128
129 echo "----- Deps check ok"
130 rm -rf deptest
131 exit 0