summaryrefslogtreecommitdiffstats
path: root/tests/generate-symbols-list
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 08:06:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 08:06:26 +0000
commit1660d4b7a65d9ad2ce0deaa19d35579ca4084ac5 (patch)
tree6cf8220b628ebd2ccfc1375dd6516c6996e9abcc /tests/generate-symbols-list
parentInitial commit. (diff)
downloadcryptsetup-upstream.tar.xz
cryptsetup-upstream.zip
Adding upstream version 2:2.6.1.upstream/2%2.6.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/generate-symbols-list')
-rwxr-xr-xtests/generate-symbols-list35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/generate-symbols-list b/tests/generate-symbols-list
new file mode 100755
index 0000000..33a2e23
--- /dev/null
+++ b/tests/generate-symbols-list
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+function fail()
+{
+ [ -n "$1" ] && echo "$1"
+ exit 2
+}
+
+function generate() {
+ local ver=
+
+ while IFS= read -r line; do
+ local len=${#line}
+
+
+ if [ "${line:0:11}" = "CRYPTSETUP_" ]; then
+ local i=12
+ while [ $i -lt $len ]; do
+ if [ "${line:$i:1}" = "{" ]; then
+ ver=${line:0:$i}
+ break
+ fi
+ i=$((i+1))
+ done
+ elif [ "${line:0:6}" = "crypt_" -a -n "$ver" ]; then
+ printf 'CHECK_SYMBOL(%s, %s)\n' $line $ver
+ fi
+ done < <(tr -d '[:blank:];' < $1)
+}
+
+test $# -ge 1 || fail "usage: $0 <symbol_file>"
+
+test -f $1 || fail "$1 is not a file."
+
+generate $1