mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-12 05:02:57 +00:00
Move temporary list scripts to tests/scripts
This commit is contained in:
33
tests/scripts/list-enum-consts.pl
Executable file
33
tests/scripts/list-enum-consts.pl
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use utf8;
|
||||
use open qw(:std utf8);
|
||||
|
||||
@ARGV = <include/mbedtls/*.h>;
|
||||
|
||||
my @consts;
|
||||
my $state = 'out';
|
||||
while (<>)
|
||||
{
|
||||
if( $state eq 'out' and /^(typedef )?enum {/ ) {
|
||||
$state = 'in';
|
||||
} elsif( $state eq 'out' and /^(typedef )?enum/ ) {
|
||||
$state = 'start';
|
||||
} elsif( $state eq 'start' and /{/ ) {
|
||||
$state = 'in';
|
||||
} elsif( $state eq 'in' and /}/ ) {
|
||||
$state = 'out';
|
||||
} elsif( $state eq 'in' ) {
|
||||
s/=.*//; s!/\*.*!!; s/,.*//; s/\s+//g; chomp;
|
||||
push @consts, $_ if $_;
|
||||
}
|
||||
}
|
||||
|
||||
open my $fh, '>', 'enum-consts' or die;
|
||||
print $fh "$_\n" for sort @consts;
|
||||
close $fh or die;
|
||||
|
||||
printf "%8d enum-consts\n", scalar @consts;
|
||||
29
tests/scripts/list-identifiers.sh
Executable file
29
tests/scripts/list-identifiers.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
HEADERS=$( ls include/mbedtls/*.h | egrep -v 'compat-1.2|openssl|bn_mul' )
|
||||
|
||||
rm -f identifiers
|
||||
|
||||
grep '^[^ /#{]' $HEADERS | \
|
||||
sed -e 's/^[^:]*://' | \
|
||||
egrep -v '^(extern "C"|(typedef )?(struct|enum)( {)?$|};?$)' \
|
||||
> _decls
|
||||
|
||||
if true; then
|
||||
sed -n -e 's/.* \**\([a-zA-Z_][a-zA-Z0-9_]*\)(.*/\1/p' \
|
||||
-e 's/.*(\*\(.*\))(.*/\1/p' _decls
|
||||
grep -v '(' _decls | sed -e 's/\([a-zA-Z0-9_]*\)[;[].*/\1/' -e 's/.* \**//'
|
||||
fi > _identifiers
|
||||
|
||||
if [ $( wc -l < _identifiers ) -eq $( wc -l < _decls ) ]; then
|
||||
rm _decls
|
||||
egrep -v '^(u?int(16|32|64)_t)$' _identifiers | sort > identifiers
|
||||
rm _identifiers
|
||||
else
|
||||
echo "Mismatch" 2>&1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wc -l identifiers
|
||||
11
tests/scripts/list-macros.sh
Executable file
11
tests/scripts/list-macros.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set =eu
|
||||
|
||||
HEADERS=$( ls include/mbedtls/*.h )
|
||||
|
||||
sed -n -e 's/.*#define \([a-zA-Z0-9_]*\).*/\1/p' $HEADERS \
|
||||
| egrep -v '^(asm|inline|EMIT|_CRT_SECURE_NO_DEPRECATE)$|^MULADDC_' \
|
||||
| sort -u > macros
|
||||
|
||||
wc -l macros
|
||||
17
tests/scripts/list-symbols.sh
Executable file
17
tests/scripts/list-symbols.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
if grep -i cmake Makefile >/dev/null; then
|
||||
echo "not compatible with cmake" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp include/mbedtls/config.h{,.bak}
|
||||
scripts/config.pl full
|
||||
CFLAGS=-fno-asynchronous-unwind-tables make clean lib >/dev/null 2>&1
|
||||
mv include/mbedtls/config.h{.bak,}
|
||||
nm -gUj library/libmbedtls.a 2>/dev/null | sed -n -e 's/^_//p' | sort > exported-symbols
|
||||
make clean
|
||||
|
||||
wc -l exported-symbols
|
||||
Reference in New Issue
Block a user