From bdb0d5b39fb988755410d2a84baedfb512fb5744 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 25 Jun 2023 08:32:50 -0300 Subject: opt/tests/uninclude.sh: Do not dirty the repository To avoid race conditions with the "check-dirty-public" target. --- opt/resources/can-remove-stdbool.c.expected | 9 --------- opt/resources/can-remove-stdbool.copy.expected | 9 +++++++++ opt/resources/nothing-can-be-removed.c.expected | 7 ------- opt/resources/nothing-can-be-removed.copy.expected | 7 +++++++ opt/tests/uninclude.sh | 11 +++++------ 5 files changed, 21 insertions(+), 22 deletions(-) delete mode 100644 opt/resources/can-remove-stdbool.c.expected create mode 100644 opt/resources/can-remove-stdbool.copy.expected delete mode 100644 opt/resources/nothing-can-be-removed.c.expected create mode 100644 opt/resources/nothing-can-be-removed.copy.expected (limited to 'opt') diff --git a/opt/resources/can-remove-stdbool.c.expected b/opt/resources/can-remove-stdbool.c.expected deleted file mode 100644 index f3da0d3..0000000 --- a/opt/resources/can-remove-stdbool.c.expected +++ /dev/null @@ -1,9 +0,0 @@ - - -#include - -int -main(void) { - printf("Nothing to be removed.\n"); - return 0; -} diff --git a/opt/resources/can-remove-stdbool.copy.expected b/opt/resources/can-remove-stdbool.copy.expected new file mode 100644 index 0000000..f3da0d3 --- /dev/null +++ b/opt/resources/can-remove-stdbool.copy.expected @@ -0,0 +1,9 @@ + + +#include + +int +main(void) { + printf("Nothing to be removed.\n"); + return 0; +} diff --git a/opt/resources/nothing-can-be-removed.c.expected b/opt/resources/nothing-can-be-removed.c.expected deleted file mode 100644 index 773852f..0000000 --- a/opt/resources/nothing-can-be-removed.c.expected +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int -main(void) { - printf("Nothing to be removed.\n"); - return 0; -} diff --git a/opt/resources/nothing-can-be-removed.copy.expected b/opt/resources/nothing-can-be-removed.copy.expected new file mode 100644 index 0000000..773852f --- /dev/null +++ b/opt/resources/nothing-can-be-removed.copy.expected @@ -0,0 +1,7 @@ +#include + +int +main(void) { + printf("Nothing to be removed.\n"); + return 0; +} diff --git a/opt/tests/uninclude.sh b/opt/tests/uninclude.sh index bb11f05..0a5d41e 100755 --- a/opt/tests/uninclude.sh +++ b/opt/tests/uninclude.sh @@ -1,12 +1,13 @@ #!/bin/sh +set -eu -git restore opt/resources/ +find opt/resources/ -name '*.c' | sed 's/^\(.*\)\.c$/cp \1.c \1.copy/g' | sh # shellcheck disable=2086 -find opt/resources/ -name '*.c' | - sh ~/.usr/bin/uninclude -E '^#include ' -- cc $CFLAGS +find opt/resources/ -name '*.copy' | + uninclude -E '^#include ' -- $CC $CFLAGS -c -find opt/resources/ -name '*.c' | while read -r file; do +find opt/resources/ -name '*.copy' | while read -r file; do if ! cmp -s "$file" "$file".expected; then cat <<-EOF The unincluded file is different from expected. @@ -15,8 +16,6 @@ find opt/resources/ -name '*.c' | while read -r file; do $ diff -U5 $file.expected $file EOF exit 1 - else - git restore "$file" fi done -- cgit v1.2.3