mirror of https://github.com/pwndbg/pwndbg
Format shell scripts with shfmt (#1123)
* Add lint.sh script * Format shell scripts with shfmt and add to lint.sh Co-authored-by: Disconnect3d <dominik.b.czarnota@gmail.com>
This commit is contained in:
parent
2b62259d7e
commit
cc50024417
|
@ -23,6 +23,7 @@ jobs:
|
|||
pip install isort
|
||||
pip install black
|
||||
pip install flake8
|
||||
sudo snap install shfmt
|
||||
|
||||
- name: Run linters
|
||||
run: |
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
cat > $1.rst <<EOF
|
||||
cat >$1.rst <<EOF
|
||||
:mod:\`pwndbg.$1\` --- pwndbg.$1
|
||||
=============================================
|
||||
|
||||
|
|
3
lint.sh
3
lint.sh
|
@ -6,3 +6,6 @@ set -o errexit
|
|||
isort --check-only --diff pwndbg tests
|
||||
black --diff --check pwndbg tests
|
||||
flake8 --show-source pwndbg tests
|
||||
|
||||
# Indents are four spaces, binary ops can start a line, and indent switch cases
|
||||
shfmt -i 4 -bn -ci -d .
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
# Benchmark context command
|
||||
make test > /dev/null
|
||||
make test >/dev/null
|
||||
git log --abbrev-commit --pretty=oneline HEAD^..HEAD
|
||||
gdb ./test \
|
||||
-ex "source ../gdbinit.py" \
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
if ! (( $# )); then
|
||||
cat <<- _EOF_
|
||||
if ! (($#)); then
|
||||
cat <<-_EOF_
|
||||
$0: [profile-script]
|
||||
|
||||
Example: $0 context.py
|
||||
|
@ -13,7 +13,7 @@ module=$(basename "${1/.py/}")
|
|||
basedir=$(dirname "$0")
|
||||
|
||||
# Quick and dirty script to profile pwndbg using cProfile.
|
||||
make -C "${basedir}" test > /dev/null
|
||||
make -C "${basedir}" test >/dev/null
|
||||
|
||||
gdb "${basedir}/test" \
|
||||
-ex "source ${basedir}/../gdbinit.py" \
|
||||
|
|
8
setup.sh
8
setup.sh
|
@ -22,7 +22,7 @@ install_apt() {
|
|||
sudo apt-get update || true
|
||||
sudo apt-get install -y git gdb python3-dev python3-pip python3-setuptools libglib2.0-dev libc6-dbg
|
||||
|
||||
if uname -m | grep x86_64 > /dev/null; then
|
||||
if uname -m | grep x86_64 >/dev/null; then
|
||||
sudo dpkg --add-architecture i386 || true
|
||||
sudo apt-get update || true
|
||||
sudo apt-get install -y libc6-dbg:i386 || true
|
||||
|
@ -51,7 +51,7 @@ install_zypper() {
|
|||
sudo zypper refresh || true
|
||||
sudo zypper install -y gdb gdbserver python-devel python3-devel python2-pip python3-pip glib2-devel make glibc-debuginfo
|
||||
|
||||
if uname -m | grep x86_64 > /dev/null; then
|
||||
if uname -m | grep x86_64 >/dev/null; then
|
||||
sudo zypper install -y glibc-32bit-debuginfo || true
|
||||
fi
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ git submodule update --init --recursive
|
|||
PYVER=$(gdb -batch -q --nx -ex 'pi import platform; print(".".join(platform.python_version_tuple()[:2]))')
|
||||
PYTHON+=$(gdb -batch -q --nx -ex 'pi import sys; print(sys.executable)')
|
||||
if ! osx; then
|
||||
PYTHON+="${PYVER}"
|
||||
PYTHON+="${PYVER}"
|
||||
fi
|
||||
|
||||
# Find the Python site-packages that we need to use so that
|
||||
|
@ -164,5 +164,5 @@ ${PYTHON} -m pip install ${INSTALLFLAGS} -Ur requirements.txt
|
|||
|
||||
# Load Pwndbg into GDB on every launch.
|
||||
if ! grep pwndbg ~/.gdbinit &>/dev/null; then
|
||||
echo "source $PWD/gdbinit.py" >> ~/.gdbinit
|
||||
echo "source $PWD/gdbinit.py" >>~/.gdbinit
|
||||
fi
|
||||
|
|
8
tests.sh
8
tests.sh
|
@ -19,7 +19,7 @@ TEST_NAME_FILTER=""
|
|||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-p|--pdb)
|
||||
-p | --pdb)
|
||||
USE_PDB=1
|
||||
echo "Will run tests with Python debugger"
|
||||
shift
|
||||
|
@ -34,7 +34,6 @@ while [[ $# -gt 0 ]]; do
|
|||
esac
|
||||
done
|
||||
|
||||
|
||||
if [[ -z "$ZIGPATH" ]]; then
|
||||
# If ZIGPATH is not set, set it to $pwd/.zig
|
||||
# In Docker environment this should by default be set to /opt/zig
|
||||
|
@ -42,7 +41,6 @@ if [[ -z "$ZIGPATH" ]]; then
|
|||
fi
|
||||
echo "ZIGPATH set to $ZIGPATH"
|
||||
|
||||
|
||||
cd ./tests/binaries || exit 1
|
||||
make clean && make all || exit 2
|
||||
cd ../../
|
||||
|
@ -76,9 +74,9 @@ for test_case in ${TESTS_LIST}; do
|
|||
|
||||
exit_status=$?
|
||||
if [ ${exit_status} -eq 0 ]; then
|
||||
(( ++tests_passed_or_skipped ))
|
||||
((++tests_passed_or_skipped))
|
||||
else
|
||||
(( ++tests_failed ))
|
||||
((++tests_failed))
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
Loading…
Reference in New Issue