Skip to content

Commit

Permalink
Add testing of disassembly and assembly to the stress tester
Browse files Browse the repository at this point in the history
BUG=259153
TEST=run_stress_test data/x86-mario_3701.98.0/bin/ data/x86-mario_4206.0.0/bin/ st_bin_x86_test; analyze_stress_test st_bin_x86_test/log;

Review URL: https://chromiumcodereview.appspot.com/19278002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212430 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
paulgazz@chromium.org committed Jul 18, 2013
1 parent 7eb7987 commit 5533fad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions courgette/analyze_stress_test
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ EOF
cat <<EOF
$(count_result "PASS_COURGETTE") successful courgette patches
$(count_result "FAIL_COURGETTE") failed courgette patches
$(count_result "FAIL_DISASSEMBLE") failed to disassemble/assemble
$(count_result "PASS_BSDIFF") succesful bsdiff patches
$(count_result "FAIL_BSDIFF") failed bsdiff patches
$(count_result "BEST_COURGETTE") patch(es) where courgette is smaller
Expand Down
34 changes: 33 additions & 1 deletion courgette/run_stress_test
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ outdir_prefix="stress_test_"
if [ $# -lt 2 ]; then
cat <<EOF
USAGE: $(basename ${0}) dir1 dir2 [outdir]
USAGE: $(basename ${0}) [-s] dir1 dir2 [outdir]
-s only test files supported by courgette
Stress test courgette by generating and applying patches for two given
directories, dir1 and dir2. The test will use files with the same
Expand All @@ -29,6 +31,13 @@ EOF
exit 1
fi

if [ "${1}" == "-s" ]; then
test_supported_only=true
shift
else
test_supported_only=
fi

dir1="${1}"
if [ ! -e "${dir1}" ]; then
error "\"${dir1}\" not found"
Expand All @@ -51,6 +60,7 @@ mkdir -p "${out_dir}" || exit 1

patches_dir="${out_dir}/patches"
applied_dir="${out_dir}/applied"
dis_dir="${out_dir}/dis"
bsdiff="${out_dir}/bsdiff"
log="${out_dir}/log"
results="${out_dir}/results"
Expand All @@ -64,6 +74,20 @@ run_test() {
local file2="${2}"
local patch="${patches_dir}/${file1}.patch"
local apply="${applied_dir}/${file2}.applied"
local dis="${dis_dir}/${file1}.dis"
local asm="${dis_dir}/${file1}.asm"
mkdir -p "$(dirname "${dis}")"
if [ ! $test_supported_only ]; then
courgette -supported "${file1}" >/dev/null
if [ "${?}" -eq 0 ]; then
courgette -dis "${file1}" "${dis}"
courgette -asm "${dis}" "${asm}"
cmp -s "${file1}" "${asm}"
if [ "${?}" -ne 0 ]; then
echo "FAIL_DISASSEMBLE ${file1}"
fi
fi
fi
mkdir -p "$(dirname "${patch}")"
mkdir -p "$(dirname "${apply}")"
courgette -gen "${file1}" "${file2}" "${patch}"
Expand Down Expand Up @@ -107,6 +131,12 @@ time diff -qr "${dir1}" "${dir2}" 2>/dev/null \
# contain spaces.
file1="$(echo "${file}" | awk '{print $1}')"
file2="$(echo "${file}" | awk '{print $2}')"
if [ $test_supported_only ]; then
courgette -supported "${file1}" >/dev/null
if [ "${?}" -ne 0 ]; then
continue;
fi
fi
run_test "${file1}" "${file2}"
done 2>&1 | tee -a "${log}"

Expand All @@ -124,6 +154,8 @@ cat <<EOF | tee -a "${log}"
$(count_result "PASS_COURGETTE") successful courgette patches
$(count_result "FAIL_COURGETTE") failed courgette patches (search log for \
"^FAIL_COURGETTE")
$(count_result "FAIL_DISASSEMBLE") failed to disassemble/assemble (search log \
for "^FAIL_DISASSEMBLE")
$(count_result "PASS_BSDIFF") succesful bsdiff patches
$(count_result "FAIL_BSDIFF") failed bsdiff patches
$(count_result "BEST_COURGETTE") patch(es) where courgette is smaller
Expand Down

0 comments on commit 5533fad

Please sign in to comment.