Skip to content

Commit

Permalink
more fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
martukas committed Oct 29, 2024
1 parent 3be0b01 commit ed8c1ce
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
name: Run unit tests
command: |
cd software/debug
poetry install
poetry install --no-interaction
poetry run pytest -v
Expand Down
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,22 @@ test_data/

#Conan created files
CMakeUserPresets.json

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
19 changes: 0 additions & 19 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
_build
_static
_templates

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
12 changes: 12 additions & 0 deletions software/common/base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ function clean_dir() {
fi
}

function create_clean_dir() {
dir_name=$1
clean_dir "$dir_name"
if mkdir "$dir_name"; then
echo "Clean directory created: $dir_name"
return "$EXIT_SUCCESS"
else
echo "Creating directory failed: $dir_name"
return "$EXIT_FAILURE"
fi
}

function install_py() {
sudo apt update
sudo apt install -y \
Expand Down
14 changes: 9 additions & 5 deletions software/controller/controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,24 @@ generate_coverage_reports() {

}

function run_debug() {
../debug/debug.sh "$@"
}

# prints info from device manifest, if SN is defined in environment
print_device_info() {
if [ -n "$SN" ]
then
echo "SN has been defined in environment, will be deploying to the following device:"
../debug/debug.sh -c "device find $SN"
run_debug -c "device find $SN"
fi
}

# get_hla_serial <alias>
# prints ST-Link serial number by defined alias
get_hla_serial() {
device_alias="$1"
../debug/debug.sh -c "device find $device_alias h"
run_debug -c "device find $device_alias h"
}

# build <target_name>
Expand Down Expand Up @@ -408,9 +412,9 @@ elif [ "$1" == "debug" ]; then
shift
if [ -n "$SN" ]
then
../debug/debug.sh -d "$SN" "$@"
run_debug -d "$SN" "$@"
else
../debug/debug.sh "$@"
run_debug "$@"
fi
exit_good

Expand Down Expand Up @@ -442,7 +446,7 @@ elif [ "$1" == "integrate" ]; then
# DEVICES #
###########
elif [ "$1" == "devices" ]; then
../debug/debug.sh -c "device list"
run_debug -c "device list"
exit_good

################
Expand Down
19 changes: 0 additions & 19 deletions software/debug/.gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
# generated network protocol code
debug/protocols/*

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json
23 changes: 8 additions & 15 deletions software/debug/debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,22 @@
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.

# Fail if any command fails
set -e
set -o pipefail

# Print each command as it executes
if [ -n "$VERBOSE" ]; then
set -o xtrace
fi

# Silent pushd
pushd () {
command pushd "$@" > /dev/null
function pushd() {
command pushd "$@" > /dev/null
}

# Silent popd
popd () {
command popd > /dev/null
function popd() {
command popd > /dev/null
}


# This script should work no matter where you call it from.
MY_PATH="$(dirname "$0")"

pushd $MY_PATH
PYTHONPATH=$MY_PATH ./debug_cli.py "${@:1}"

poetry install --no-root --quiet
poetry run debug "${@:1}"

popd
6 changes: 3 additions & 3 deletions software/gui/gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ configure_conan() {
}

run_cppcheck() {
clean_dir build/cppcheck
create_clean_dir build/cppcheck
cppcheck --enable=all --std=c++17 --inconclusive --force --inline-suppr --quiet \
--enable=information --check-config \
-I ../common/generated_libs/protocols \
Expand Down Expand Up @@ -220,7 +220,7 @@ elif [ "$1" == "build" ]; then
checks_opt="no"
fi

clean_dir build
create_clean_dir build

pushd build
if [ "$checks_opt" == "yes" ]; then
Expand Down Expand Up @@ -268,7 +268,7 @@ elif [ "$1" == "test" ]; then
j_opt="-j${NUM_CPUS}"
fi

clean_dir build
create_clean_dir build

pushd build
cmake -DCMAKE_BUILD_TYPE=Debug -DCOV=1 ..
Expand Down

0 comments on commit ed8c1ce

Please sign in to comment.