Skip to content
Snippets Groups Projects
Commit d4a5a879 authored by Andre Maroneze's avatar Andre Maroneze
Browse files

[tests] fix compatibility with dune

parent 9741d0da
No related branches found
No related tags found
No related merge requests found
...@@ -4,14 +4,12 @@ ...@@ -4,14 +4,12 @@
errors=0 errors=0
if [ "$#" -ge 1 ] && [ -d "$1" ]; then test_dir=$(pwd)
cd "$1" share_libc="$1"
else cd "$share_libc"
cd share/libc
fi
for A in *.h */*.h; do for A in *.h */*.h; do
if ! grep -q $A ../../tests/libc/fc_libc.c if ! grep -q $A "$test_dir/fc_libc.c"
then then
echo "missing include in tests/libc/fc_libc.c: $A" echo "missing include in tests/libc/fc_libc.c: $A"
errors=$((errors+1)) errors=$((errors+1))
...@@ -24,7 +22,7 @@ for A in *.h */*.h; do ...@@ -24,7 +22,7 @@ for A in *.h */*.h; do
done done
for A in *.c */*.c; do for A in *.c */*.c; do
if ! grep -q $A __fc_runtime.c ../../tests/libc/fc_libc.c if ! grep -q $A __fc_runtime.c "$test_dir/fc_libc.c"
then then
echo "missing include in share/libc/__fc_runtime.c or tests/libc/fc_libc.c: $A" echo "missing include in share/libc/__fc_runtime.c or tests/libc/fc_libc.c: $A"
errors=$((errors+1)) errors=$((errors+1))
......
...@@ -7,16 +7,17 @@ let header_re = Str.regexp ".*\\.h$" ...@@ -7,16 +7,17 @@ let header_re = Str.regexp ".*\\.h$"
let is_header f = Str.string_match header_re f 0 let is_header f = Str.string_match header_re f 0
(* Files which are *not* supposed to be parsed *) (* Files which are *not* supposed to be parsed *)
let blacklist () = let blacklist libc_dir =
let libc = (Filename.concat (Sys.getenv "FRAMAC_SHARE") "libc") in
List.map (fun f -> List.map (fun f ->
Datatype.Filepath.of_string (Filename.concat libc f)) Datatype.Filepath.concat libc_dir f)
["tgmath.h"; "complex.h"; "__fc_machdep_linux_shared.h"] ["tgmath.h"; "complex.h"; "__fc_machdep_linux_shared.h"]
(* only goes down one level, which is enough for the libc *) (* only goes down one level, which is enough for the libc *)
let collect_headers libc_dir = let collect_headers () =
let libc_dir = Kernel.Share.get_dir ~mode:`Must_exist "libc" in
let libc_dir_files = Array.to_list (Sys.readdir (libc_dir :> string)) in
let contents = let contents =
List.map (Filename.concat libc_dir) (Array.to_list (Sys.readdir libc_dir)) List.map (Filename.concat (libc_dir :> string)) libc_dir_files
in in
let subdirs = List.filter Sys.is_directory contents in let subdirs = List.filter Sys.is_directory contents in
let base_headers = List.filter is_header contents in let base_headers = List.filter is_header contents in
...@@ -29,7 +30,7 @@ let collect_headers libc_dir = ...@@ -29,7 +30,7 @@ let collect_headers libc_dir =
) base_headers subdirs ) base_headers subdirs
in in
let all_headers = List.sort Extlib.compare_ignore_case all_headers in let all_headers = List.sort Extlib.compare_ignore_case all_headers in
let to_skip = blacklist () in let to_skip = blacklist libc_dir in
List.iter (fun header -> List.iter (fun header ->
let header_path = Datatype.Filepath.of_string header in let header_path = Datatype.Filepath.of_string header in
if List.mem header_path to_skip then if List.mem header_path to_skip then
...@@ -42,4 +43,4 @@ let collect_headers libc_dir = ...@@ -42,4 +43,4 @@ let collect_headers libc_dir =
) all_headers ) all_headers
let () = let () =
Db.Main.apply (collect_headers (Filename.concat (Sys.getenv "FRAMAC_SHARE") "libc")) Db.Main.extend collect_headers
[kernel] Parsing fc_libc.c (with preprocessing)
[kernel] Parsing FRAMAC_SHARE/libc/__fc_alloc_axiomatic.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/libc/__fc_alloc_axiomatic.h (with preprocessing)
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin.h (with preprocessing)
[kernel] Parsing FRAMAC_SHARE/libc/__fc_define_blkcnt_t.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/libc/__fc_define_blkcnt_t.h (with preprocessing)
...@@ -154,4 +155,3 @@ skipping FRAMAC_SHARE/libc/tgmath.h ...@@ -154,4 +155,3 @@ skipping FRAMAC_SHARE/libc/tgmath.h
[kernel] Parsing FRAMAC_SHARE/libc/wchar.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/libc/wchar.h (with preprocessing)
[kernel] Parsing FRAMAC_SHARE/libc/wctype.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/libc/wctype.h (with preprocessing)
[kernel] Parsing FRAMAC_SHARE/libc/wordexp.h (with preprocessing) [kernel] Parsing FRAMAC_SHARE/libc/wordexp.h (with preprocessing)
[kernel] Parsing fc_libc.c (with preprocessing)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment