Skip to content

Commit b7ec50a

Browse files
committed
Add find cross include tool
1 parent ce6ad22 commit b7ec50a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/findcrossinclude.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# ideally we want this dependency:
4+
# - saimetadata - no dependency
5+
# - saimeta - depends on saimetadata
6+
# - sairedis - depends on saimeta
7+
# - saivs - depends on saimeta
8+
# - syncd - depnds on sairedis/saivs
9+
10+
# some headers like sairedis.h and sairediscommon.h are cross used on all projects
11+
12+
echo -- find Makefile.am files with cross directory file include
13+
14+
find .. -name Makefile.am | grep -vP "SAI/|pyext/" | xargs grep -P "\.\./"
15+
16+
echo -- find cross include dependencies between meta/lib/vslib directory
17+
18+
find ../meta ../lib ../vslib -name "*.cpp" -o -name "*.h" | \
19+
xargs grep -P "#include.+/" | grep -vP "(meta/|swss/)" | grep -vP "include <(linux|sys|net|arpa)"
20+
21+
echo -- find cross include in meta/Makefile.am
22+
23+
grep -P "FLAGS.+(lib|vslib|syncd)" ../meta/Makefile.am
24+
25+
echo -- find cross include in lib/src/Makefile.am
26+
27+
grep -P "FLAGS.+(vslib|syncd)" ../lib/src/Makefile.am
28+
29+
echo -- find cross include in vslib/src/Makefile.am
30+
31+
grep -P "FLAGS.+(lib|syncd)" ../vslib/src/Makefile.am
32+
33+
echo -- find cross include in meta directory
34+
35+
find ../meta/.deps -name "*.Plo" -o -name "*.Po"|xargs grep -P "[^r]/lib/|vslib/|syncd/"| \
36+
perl -npe 's!lib/inc/sairedis(common)?.h!!g' | grep -P "[^r]/lib/|vslib/|syncd/" | grep -v deps/test
37+
38+
echo -- find cross include in lib/src directory
39+
40+
find ../lib/src/.deps -name "*.Plo" -o -name "*.Po"|xargs grep -P "vslib/|syncd/"
41+
42+
echo -- find cross include in vslib/src directory
43+
44+
find ../vslib/src/.deps -name "*.Plo" -o -name "*.Po"|xargs grep -P "[^r]/lib/|syncd/"| \
45+
perl -npe 's!lib/inc/sairedis.h!!g' | grep -P "[^r]/lib/|syncd/"

0 commit comments

Comments
 (0)