Skip to content

Instantly share code, notes, and snippets.

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 cladmi/9818888da7412a9195ec0d4c3c2a8b8a to your computer and use it in GitHub Desktop.
Save cladmi/9818888da7412a9195ec0d4c3c2a8b8a to your computer and use it in GitHub Desktop.
compare_riot_repositories_variable_value.sh
#! /bin/bash
# Compare the value of a variable for all applicatinos and boards between
# two different riot versions.
#
# This assumes both versions have the same applications and boards as only
# 'riot_master' is checked to list all of them.
# Global variables
# RIOT_MASTER
# RIOT_PR
# VARIABLE
usage() {
echo "Usage: $0 <RIOT_MASTER> <RIOT_PULL_REQUEST> <VARIABLE>"
}
check_application_board() {
local application="$1"
local board="$2"
local master
local pr
master="$(BOARD=${board} make --no-print-directory -C "${RIOT_MASTER}"/"${application}" info-debug-variable-"${VARIABLE}")"
pr="$(BOARD=${board} make --no-print-directory -C "${RIOT_PR}"/"${application}" info-debug-variable-"${VARIABLE}")"
diff -q <(echo "$master") <(echo "$pr") || echo "${application} ${board} differ for ${VARIABLE}" >&2
}
check_application() {
local application="$1"
local supported_boards
local board
supported_boards=$(make --no-print-directory -C "${RIOT_MASTER}"/"${application}" info-boards-supported)
for board in ${supported_boards}; do
check_application_board "${application}" "${board}"
done
}
main() {
if [[ $# -ne 3 ]]
then
usage
exit 1
fi
# Global variables for simplicity
RIOT_MASTER="$1"
RIOT_PR="$2"
VARIABLE="$3"
local applications
local application
applications=$(make --no-print-directory -C "${RIOT_MASTER}" info-applications)
for application in ${applications}; do
check_application "${application}"
done
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment