From e1915bc73413a0fa634f2e221441694f87048d52 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 12 Jun 2020 23:26:51 -0700 Subject: [PATCH] Update paths of scripts to allow building on BSD Prior to this change, the assumption in all shell and Python scripts was that the Bash interpreter would always be available at `/bin/bash`, and Python would always be available at `/usr/bin/python`. However, on a VM running FreeBSD, installing bash and python using the pkg command installs them under /usr/local/bin. This change updates the paths to use /usr/bin/env in the shebang. While this is not a standard path either, it is more likely to be available at this location. This change also updates the find command in common_infra.sh to use `-perm -+x` in lieu of `-executable`, which is not a condition defined by POSIX. This allows running the tests on BSD. --- lib/libx52util/x52_char_map_gen.py | 2 +- tests/common_infra.sh | 6 +++--- tests/libx52/test_brightness | 2 +- tests/libx52/test_clock | 2 +- tests/libx52/test_indicator | 2 +- tests/libx52/test_leds | 2 +- tests/libx52/test_mfd | 2 +- tests/libx52/test_timezone | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/libx52util/x52_char_map_gen.py b/lib/libx52util/x52_char_map_gen.py index 8f5a1f4..f52a9d6 100755 --- a/lib/libx52util/x52_char_map_gen.py +++ b/lib/libx52util/x52_char_map_gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # Character map generator # # Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) diff --git a/tests/common_infra.sh b/tests/common_infra.sh index 02f9be6..80c0e57 100644 --- a/tests/common_infra.sh +++ b/tests/common_infra.sh @@ -79,7 +79,7 @@ find_programs() fi # Find the X52cli script - X52CLI=$(find .. -path '*/cli/x52cli' -executable) + X52CLI=$(find .. -path '*/cli/x52cli' -perm -+x) if [[ -z "$X52CLI" ]] then @@ -87,14 +87,14 @@ find_programs() fi # Find the x52test_log_actions program - X52LOGACT=$(find .. -path '*/libusbx52/x52test_log_actions' -executable) + X52LOGACT=$(find .. -path '*/libusbx52/x52test_log_actions' -perm -+x) if [[ -z "$X52LOGACT" ]] then exit 1 fi # Find the x52test_create_device_list program - X52DEVLIST=$(find .. -path '*/libusbx52/x52test_create_device_list' -executable) + X52DEVLIST=$(find .. -path '*/libusbx52/x52test_create_device_list' -perm -+x) if [[ -z "$X52DEVLIST" ]] then exit 1 diff --git a/tests/libx52/test_brightness b/tests/libx52/test_brightness index 2e6d655..b2d279f 100755 --- a/tests/libx52/test_brightness +++ b/tests/libx52/test_brightness @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # MFD & LED brightness tests # # Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) diff --git a/tests/libx52/test_clock b/tests/libx52/test_clock index 7e5b0d1..def836d 100755 --- a/tests/libx52/test_clock +++ b/tests/libx52/test_clock @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Clock tests # # Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) diff --git a/tests/libx52/test_indicator b/tests/libx52/test_indicator index 0caf456..8b4dcbb 100755 --- a/tests/libx52/test_indicator +++ b/tests/libx52/test_indicator @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Indicator (blink & shift) tests # # Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) diff --git a/tests/libx52/test_leds b/tests/libx52/test_leds index 4b61bc1..569410c 100755 --- a/tests/libx52/test_leds +++ b/tests/libx52/test_leds @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # LED tests # # Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) diff --git a/tests/libx52/test_mfd b/tests/libx52/test_mfd index 7e11324..0784080 100755 --- a/tests/libx52/test_mfd +++ b/tests/libx52/test_mfd @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # MFD tests # # Copyright (C) 2012-2018 Nirenjan Krishnan (nirenjan@nirenjan.org) diff --git a/tests/libx52/test_timezone b/tests/libx52/test_timezone index 083e350..5c65453 100755 --- a/tests/libx52/test_timezone +++ b/tests/libx52/test_timezone @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Timezone tests # # Copyright (C) 2020 Nirenjan Krishnan (nirenjan@nirenjan.org)