Skip to content

Instantly share code, notes, and snippets.

@Krellan
Last active April 4, 2022 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krellan/a835a635597eeed3ca4190e52b8d26b4 to your computer and use it in GitHub Desktop.
Save Krellan/a835a635597eeed3ca4190e52b8d26b4 to your computer and use it in GitHub Desktop.
run-test
#!/bin/bash
# bmcweb run-test convenience script, similar to run-ci
# https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/52444
set -e
set -x
# Clean up after previous run
rm -rf builddir
# Combination of useful options
meson builddir -Dbuildtype=minsize -Db_lto=true -Db_coverage=true -Dtests=enabled -Dbmcweb-logging=enabled
# Compile
ninja -C builddir
# Help out CLion and other IDE editors without native meson/ninja support
mapfile -t RULES < <( grep '^rule ' < builddir/build.ninja | cut '-d ' -f2 )
ninja -C builddir -t compdb "${RULES[@]}" > builddir/compile_commands.json
# Code coverage
ninja -C builddir test
ninja -C builddir coverage
# Unit test
./builddir/bmcweb_unit_test
rm -f ./builddir/bmcweb_persistent_data.json
rm -f ./bmcweb_persistent_data.json
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment