kripken/emscripten — pull request #1924 by ehostunreach (2013-12-14 15:49:51+00:00)
Title: Fix indentation of core test files

This set of commits fixes the indentation of every single core test input file, except for ```test_indirectbr_many.in```.

Below, you can see the script I used in order to fix each test's indentation. I've used ```clang-format``` from
the clang's master (the tests were run with clang-3.2). The results are nice except for some lines that were
longer than 80 columns.

```bash
#!/bin/bash

# place & run this file inside tests/core

# exit if any command fails
set -e

RUNNER=../runner.py
LOG_FILE=$HOME/repos/tmp/log.txt
CLANG_FORMAT=/home/vk/opt/llvm_master/bin/clang-format

# clean log file from previous run
if [ -f $LOG_FILE ]; then
rm $LOG_FILE
fi

test_files=`ls *.in`

# for each test file input
for test_file in $test_files
do
# retrieve the name of the test
test_name="${test_file%.*}"

# ignore or handle manually the following tests
if [ "$test_name" == "test_dlfcn_self" ]; then
echo "Skipping already commited test: $test_name" >> $LOG_FILE
continue
fi
if [ "$test_name" == "test_llvm_used" ]; then
echo "Skipping already commited test: $test_name" >> $LOG_FILE
continue
fi
if [ "$test_name" == "test_indirectbr_many" ]; then
echo "Skipping computed gotos test: $test_name" >> $LOG_FILE
continue
fi

# run this test
python $RUNNER $test_name 2>&1 >> $LOG_FILE

# indent the file & remove leading newlines
$CLANG_FORMAT --style=google $test_file \
| tac | perl -i -pe 'chomp if eof' | tac > /tmp/src.in
cp /tmp/src.in $test_file

# run this test
python $RUNNER $test_name 2>&1 >> $LOG_FILE

git add $test_file
git commit -m "$test_name: fix indentation"

echo "commited: $test_name" >> $LOG_FILE
echo ""
done
```

Some notes:
* I fixed the indentation of ```test_llvm_used``` manually, because ```clang-format``` produces wrong output for this specific test.
* The ```test_dlfcn_self``` fails on my computer. I've included it in my previous PR by accident. Despite that the changes were trivial.
* I didn't fix the indentation of ```test_indirectbr_many``` because I intend to simplify it with some macro preprocessing in another PR.