David Eichmann pushed to branch wip/davide/rts-public_baseline at Glasgow Haskell Compiler / GHC
Commits:
-
c13de886
by David Eichmann at 2026-11-02T14:56:56+00:00
4 changed files:
- testsuite/tests/rts/symbols/Main.hs
- testsuite/tests/rts/symbols/all.T
- + testsuite/tests/rts/symbols/expected/.gitkeep
- testsuite/tests/rts/symbols/rts-check-symbols.sh
Changes:
| ... | ... | @@ -3,6 +3,8 @@ import qualified Data.Set as S |
| 3 | 3 | import Data.List (isSuffixOf, stripPrefix)
|
| 4 | 4 | import Data.Maybe (mapMaybe)
|
| 5 | 5 | import System.Environment (getArgs)
|
| 6 | +import System.FilePath
|
|
| 7 | +import System.Directory
|
|
| 6 | 8 | |
| 7 | 9 | -- Symbols to be ignored. These are symbols that are gated on CPP ant not correctly
|
| 8 | 10 | -- specified in RtsSymbols.c. This means the symbol will sometimes appear in the
|
| ... | ... | @@ -154,6 +156,12 @@ main = do |
| 154 | 156 | -- writeFile "<ghc root>/testsuite/tests/rts/symbols/rts-check-symbols.stdout"
|
| 155 | 157 | putStrLn diffStr
|
| 156 | 158 | |
| 159 | + -- Formats all symbols from readelf output
|
|
| 160 | + ["full-dump", observedSymbolsFile] -> do
|
|
| 161 | + observedSymbolsStr <- readFile observedSymbolsFile
|
|
| 162 | + let observedSymbols = parseReadelf observedSymbolsStr
|
|
| 163 | + putStrLn $ unlines [symbol ++ " " ++ show codeOrData | (symbol, codeOrData) <- M.toList observedSymbols]
|
|
| 164 | + |
|
| 157 | 165 | _ -> fail ("Unexpected arguments: " ++ show args)
|
| 158 | 166 | |
| 159 | 167 | foreign import ccall "dumpDeclaredSymbols"
|
| ... | ... | @@ -10,7 +10,8 @@ test('rts-check-symbols', [ |
| 10 | 10 | extra_files([
|
| 11 | 11 | 'dumpDeclaredSymbols.c',
|
| 12 | 12 | 'Main.hs',
|
| 13 | - 'rts-check-symbols.sh'
|
|
| 13 | + 'rts-check-symbols.sh',
|
|
| 14 | + 'expected/'
|
|
| 14 | 15 | ])],
|
| 15 | 16 | makefile_test,
|
| 16 | 17 | []
|
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | $TEST_HC $TEST_HC_OPTS \
|
| 4 | 4 | -package containers \
|
| 5 | + -package directory \
|
|
| 6 | + -package filepath \
|
|
| 5 | 7 | -dynamic \
|
| 6 | 8 | dumpDeclaredSymbols.c \
|
| 7 | 9 | -I$TOP/../rts \
|
| ... | ... | @@ -37,3 +39,19 @@ RTS_DYLIB_PATH=$(ldd ./Main | awk '/^[[:space:]]*libHSrts-.* => .+$/ { |
| 37 | 39 | readelf -W --dyn-syms "$RTS_DYLIB_PATH" > $OBSERVED_SYMBOLS
|
| 38 | 40 | |
| 39 | 41 | ./Main diff $DECLARED_SYMBOLS $OBSERVED_SYMBOLS
|
| 42 | + |
|
| 43 | + |
|
| 44 | +#
|
|
| 45 | +# Full dump/diff
|
|
| 46 | +#
|
|
| 47 | + |
|
| 48 | +DUMP=$CI_JOB_NAME-$(basename $RTS_DYLIB_PATH).dump
|
|
| 49 | +./Main full-dump $OBSERVED_SYMBOLS > $DUMP
|
|
| 50 | +if [ -f "expected/$DUMP" ]; then
|
|
| 51 | + diff "$DUMP" "expected/$DUMP"
|
|
| 52 | +else
|
|
| 53 | + echo "# No expected dump file: expected/$DUMP"
|
|
| 54 | + echo ""
|
|
| 55 | + cat "$DUMP"
|
|
| 56 | +fi
|
|
| 57 | + |