Skip to content

Commit b6ab843

Browse files
committed
Improve ABI check tool on macOS
1 parent 39a64fb commit b6ab843

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

test/check-abi-compatibility.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ OLD_VARS=_old_vars.txt
1313
NEW_VARS=_new_vars.txt
1414

1515
# Extract function symbols from the old and new libraries
16-
nm -C --defined-only $OLD_LIB | c++filt | awk '$2 ~ /[TW]/ {print substr($0, index($0,$3))}' | sort > $OLD_FUNCS
17-
nm -C --defined-only $NEW_LIB | c++filt | awk '$2 ~ /[TW]/ {print substr($0, index($0,$3))}' | sort > $NEW_FUNCS
16+
nm -C --defined-only $OLD_LIB | c++filt | awk '$2 ~ /[TWt]/ {print substr($0, index($0,$3))}' | sort > $OLD_FUNCS
17+
nm -C --defined-only $NEW_LIB | c++filt | awk '$2 ~ /[TWt]/ {print substr($0, index($0,$3))}' | sort > $NEW_FUNCS
1818

1919
# Extract variable symbols from the old and new libraries
20-
nm -C --defined-only $OLD_LIB | c++filt | awk '$2 ~ /[BDG]/ {print substr($0, index($0,$3))}' | sort > $OLD_VARS
21-
nm -C --defined-only $NEW_LIB | c++filt | awk '$2 ~ /[BDG]/ {print substr($0, index($0,$3))}' | sort > $NEW_VARS
20+
nm -C --defined-only $OLD_LIB | c++filt | awk '$2 ~ /[BDGVs]/ {print substr($0, index($0,$3))}' | sort > $OLD_VARS
21+
nm -C --defined-only $NEW_LIB | c++filt | awk '$2 ~ /[BDGVs]/ {print substr($0, index($0,$3))}' | sort > $NEW_VARS
2222

2323
# Initialize error flag and message
2424
error_flag=0
@@ -28,29 +28,29 @@ error_message=""
2828
removed_funcs=$(comm -23 $OLD_FUNCS $NEW_FUNCS)
2929
if [ -n "$removed_funcs" ]; then
3030
error_flag=1
31-
error_message+="[Removed Functions]\n$removed_funcs\n"
31+
error_message+="[Removed Functions]\n$removed_funcs\n\n"
3232
fi
3333

3434
# Check for removed variable symbols
3535
removed_vars=$(comm -23 $OLD_VARS $NEW_VARS)
3636
if [ -n "$removed_vars" ]; then
3737
error_flag=1
38-
error_message+="[Removed Variables]\n$removed_vars\n"
38+
error_message+="[Removed Variables]\n$removed_vars\n\n"
3939
fi
4040

4141
# Check for added variable symbols
4242
added_vars=$(comm -13 $OLD_VARS $NEW_VARS)
4343
if [ -n "$added_vars" ]; then
4444
error_flag=1
45-
error_message+="[Added Variables]\n$added_vars\n"
45+
error_message+="[Added Variables]\n$added_vars\n\n"
4646
fi
4747

4848
# Remove temporary files
4949
rm -f $NEW_FUNCS $OLD_FUNCS $OLD_VARS $NEW_VARS
5050

5151
# Display error messages if any
5252
if [ "$error_flag" -eq 1 ]; then
53-
echo -e "$error_message"
53+
echo -en "$error_message"
5454
echo "ABI compatibility check failed."
5555
exit 1
5656
fi

test/make-shared-library.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
if [ "$#" -ne 1 ]; then
3+
echo "Usage: $0 build_dir"
4+
exit 1
5+
fi
6+
7+
BUILD_DIR=$1
8+
9+
# Make the build directory
10+
rm -rf $BUILD_DIR
11+
mkdir -p $BUILD_DIR/out
12+
13+
cd $BUILD_DIR
14+
15+
# Build the version
16+
git checkout $BUILD_DIR -q
17+
18+
cmake \
19+
-DCMAKE_BUILD_TYPE=Debug \
20+
-DCMAKE_CXX_FLAGS="-g -Og" \
21+
-DBUILD_SHARED_LIBS=ON \
22+
-DHTTPLIB_COMPILE=ON \
23+
-DCMAKE_INSTALL_PREFIX=./out \
24+
../..
25+
26+
cmake --build . --target install
27+
cmake --build . --target clean
28+

0 commit comments

Comments
 (0)