1#!/usr/bin/env bash 2# 3# Copyright 2016 - The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17 18set -e 19 20[ -z $TOOLS_DIR ] && TOOLS_DIR=$(realpath $(dirname $0)) 21[ -z $LTP_ROOT ] && LTP_ROOT=$(realpath $TOOLS_DIR/../..) 22[ -z $TOOLS_DUMP_DIR ] && TOOLS_DUMP_DIR=$(realpath $TOOLS_DIR/dump) 23 24mkdir -p $TOOLS_DUMP_DIR 25 26if ! [ -f $LTP_ROOT/include/config.h ]; then 27 echo "" 28 echo "LTP has not been configured." 29 echo "" 30 echo "Executing \"cd $LTP_ROOT; make autotools\"" 31 (cd $LTP_ROOT; make autotools > /dev/null) 32 echo "" 33 echo "Executing \"cd $LTP_ROOT; ./configure\"" 34 (cd $LTP_ROOT; ./configure > /dev/null) 35 36 OUTPUT=$TOOLS_DUMP_DIR/config.h.dump 37 cat $LTP_ROOT/include/config.h > $OUTPUT 38fi 39 40MAKE_FLAGS="-j1 --dry-run V=1" 41 42OUTPUT=$TOOLS_DUMP_DIR/make_dry_run.dump 43CMD="make $MAKE_FLAGS -C $LTP_ROOT/testcases" 44echo "" 45echo "Dumping output to $OUTPUT from command '$CMD'" 46$CMD > $OUTPUT 47 48OUTPUT=$TOOLS_DUMP_DIR/make_install_dry_run.dump 49CMD="make $MAKE_FLAGS -C $LTP_ROOT/testcases install" 50echo "" 51echo "Dumping output to $OUTPUT from command '$CMD'" 52$CMD > $OUTPUT 53 54echo "" 55echo "Distclean $LTP_ROOT ..." 56make -C $LTP_ROOT distclean > /dev/null 57 58