• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -u
2#
3# This is one of the scripts that is passed to binary_search_state.py to do
4# the bisection.  This one takes a list of object files (either a real list or
5# a file containing the list) and copies the files from the bad objects
6# directory to the working directory.
7#
8
9source full_bisect_test/common.sh
10
11pushd ${BISECT_WORK_BUILD}
12chmod 644 *
13
14OBJ_LIST_FILES=$1
15FILE_ARGS=0
16
17if [[ -f ${OBJ_LIST_FILES} ]] ; then
18  file ${OBJ_LIST_FILES} &> ${BISECT_WORK_BUILD}/file_type.tmp
19  grep "ASCII text" ${BISECT_WORK_BUILD}/file_type.tmp
20  result=$?
21  if [[ ${result} -eq 0 ]] ; then
22    FILE_ARGS=1
23  fi
24  rm ${BISECT_WORK_BUILD}/file_type.tmp
25fi
26
27overall_status=0
28
29if [[ ${FILE_ARGS} -eq 1 ]] ; then
30  while read obj || [[ -n "${obj}" ]];
31  do
32    cp ${BISECT_BAD_BUILD}/${obj} ${BISECT_WORK_BUILD}
33    status=$?
34    if [[ ${status} -ne 0 ]] ; then
35      echo "Failed to copy ${obj} to work build tree."
36      overall_status=2
37    fi
38  done < ${OBJ_LIST_FILES}
39else
40
41  for o in "$@"
42  do
43    cp ${BISECT_BAD_BUILD}/${o} ${BISECT_WORK_BUILD}
44    status=$?
45    if [[ ${status} -ne 0 ]] ; then
46      echo "Failed to copy ${o} to work build tree."
47      overall_status=2
48    fi
49  done
50fi
51
52popd
53
54exit ${overall_status}
55