• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2################################################################################
3#
4# Copyright (C) 2022 Huawei Device Co., Ltd.
5# SPDX-License-Identifier: GPL-2.0
6#
7# Legacy blkg rwstat helpers enabled by CONFIG_BLK_CGROUP_RWSTAT.
8# Do not use in new code.
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17# File: generate_config.sh
18#
19# Description: generate config for linux test project
20#
21# Authors:     Wu Fan
22#
23# History:     August 4 2022 - generate config
24#
25################################################################################
26set -e
27IFS=$'\n'
28input_file=$2/macrolists
29change_file=$3/ltp/include/config.h
30
31function chang_config()
32{
33    while read line; do
34        if [[ "${line}" == *"#"* ]]; then
35            continue
36        else
37            macro=$(echo $line | awk -F "'" '{print $2}')
38            flag=$(echo $line | awk -F "'" '{print $4}')
39	    set +e
40            if [ "${flag}" == "true" ]; then
41                lines=$(sed -n "/${macro}/=" $change_file)
42                if [[ "${lines}" > 0 ]]; then
43                    sed -i "/${macro}/c\#define ${macro} 1" $change_file
44                else
45                    echo "#define ${macro} 1" >> $change_file
46                fi
47            else
48                sed -i "/${macro}/c\/\* \#undef ${macro} \*\/" $change_file
49            fi
50            set -e
51        fi
52    done < $input_file
53    echo "typedef unsigned int __u32;" >> $change_file
54    echo "typedef signed int __s32;" >> $change_file
55}
56
57mkdir -p $(pwd)/tests/ltp_testcases/ltp
58cp -r $(pwd)/../../third_party/ltp $(pwd)/tests/ltp_testcases
59cd $(pwd)/tests/ltp_testcases/ltp
60make autotools
61./configure --without-numa
62add_notation=./include/tst_clone.h
63sed -i "/^\#define clone/c\/\/ \#define clone(...) (use_the_ltp_clone_functions__do_not_use_clone)" $add_notation
64chang_config
65