Browse Source

Merge pull request #1730 from riscv-software-src/test-headers

Check in CI that all installed headers are usable
pull/1741/head
Andrew Waterman 2 years ago
committed by GitHub
parent
commit
4f69177d94
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      Makefile.in
  2. 2
      ci-tests/build-spike
  3. 7
      ci-tests/test-spike
  4. 0
      ci-tests/testlib.cc
  5. 4
      fdt/libfdt.h
  6. 18
      fesvr/byteorder.h
  7. 1
      fesvr/elfloader.h
  8. 1
      riscv/cfg.cc
  9. 5
      riscv/entropy_source.h
  10. 5
      softfloat/softfloat.mk.in

9
Makefile.in

@ -385,6 +385,15 @@ install-hdrs : $(install_hdrs)
$(INSTALL_HDR) $(src_dir)/$$file $(install_hdrs_dir)/`dirname $$file`; \
done
install-hdrs-list.h: $(install_hdrs)
rm -f $@.tmp
for file in $(subst $(src_dir)/,,$^); \
do \
$(MKINSTALLDIRS) $(install_hdrs_dir)/`dirname $$file`; \
echo "#include <$(src_dir)/$$file>" >> $@.tmp; \
done
mv $@.tmp $@
install-libs : $(install_libs)
$(MKINSTALLDIRS) $(install_libs_dir)
for file in $^; \

2
ci-tests/build-spike

@ -11,7 +11,7 @@ mkdir install
CXXFLAGS="-Wnon-virtual-dtor" CFLAGS="-Werror -Wignored-qualifiers -Wunused-function -Wunused-parameter -Wunused-variable" $DIR/../configure --prefix=`pwd`/install
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
make check
make install
make install install-hdrs-list.h
# check that help message prints without error
install/bin/spike -h

7
ci-tests/test-spike

@ -13,8 +13,11 @@ tar xf spike-ci.tar
time ../install/bin/spike --isa=rv64gc pk hello | grep "Hello, world! Pi is approximately 3.141588."
# check that including sim.h in an external project works
g++ -std=c++17 -I../install/include -L../install/lib $DIR/testlib.c -lriscv -o test-libriscv
g++ -std=c++17 -I../install/include -L../install/lib $DIR/test-customext.cc -lriscv -o test-customext
g++ -std=c++2a -I../install/include -L../install/lib $DIR/testlib.cc -lriscv -o test-libriscv
g++ -std=c++2a -I../install/include -L../install/lib $DIR/test-customext.cc -lriscv -o test-customext
# check that all installed headers are functional
g++ -std=c++2a -I../install/include -L../install/lib $DIR/testlib.cc -lriscv -o /dev/null -include ../install-hdrs-list.h
LD_LIBRARY_PATH=../install/lib ./test-libriscv pk hello| grep "Hello, world! Pi is approximately 3.141588."
LD_LIBRARY_PATH=../install/lib ./test-customext pk dummy-slliuw | grep "Executed successfully"

0
ci-tests/testlib.c → ci-tests/testlib.cc

4
fdt/libfdt.h

@ -6,8 +6,8 @@
* Copyright (C) 2006 David Gibson, IBM Corporation.
*/
#include <libfdt_env.h>
#include <fdt.h>
#include "libfdt_env.h"
#include "fdt.h"
#define FDT_FIRST_SUPPORTED_VERSION 0x02
#define FDT_LAST_SUPPORTED_VERSION 0x11

18
fesvr/byteorder.h

@ -3,8 +3,8 @@
#ifndef _RISCV_BYTEORDER_H
#define _RISCV_BYTEORDER_H
#include "config.h"
#include <stdint.h>
#include <arpa/inet.h>
static inline uint8_t swap(uint8_t n) { return n; }
static inline uint16_t swap(uint16_t n) { return (n >> 8) | (n << 8); }
@ -22,17 +22,11 @@ static inline uint128_t swap(uint128_t n) { return (uint128_t(swap(uint64_t(n)))
static inline int128_t swap(int128_t n) { return int128_t(swap(uint128_t(n))); }
#endif
#ifdef WORDS_BIGENDIAN
template<typename T> static inline T from_be(T n) { return n; }
template<typename T> static inline T to_be(T n) { return n; }
template<typename T> static inline T from_le(T n) { return swap(n); }
template<typename T> static inline T to_le(T n) { return swap(n); }
#else
template<typename T> static inline T from_le(T n) { return n; }
template<typename T> static inline T to_le(T n) { return n; }
template<typename T> static inline T from_be(T n) { return swap(n); }
template<typename T> static inline T to_be(T n) { return swap(n); }
#endif
static inline bool is_be() { return htonl(1) == 1; }
template<typename T> static inline T from_be(T n) { return is_be() ? n : swap(n); }
template<typename T> static inline T to_be(T n) { return from_be(n); }
template<typename T> static inline T from_le(T n) { return is_be() ? swap(n) : n; }
template<typename T> static inline T to_le(T n) { return from_le(n); }
// Wrapper to mark a value as target endian, to guide conversion code

1
fesvr/elfloader.h

@ -4,6 +4,7 @@
#define _ELFLOADER_H
#include "elf.h"
#include "memif.h"
#include <map>
#include <string>

1
riscv/cfg.cc

@ -1,5 +1,6 @@
// See LICENSE for license details.
#include "config.h"
#include "cfg.h"
#include "mmu.h"
#include "decode.h"

5
riscv/entropy_source.h

@ -1,3 +1,7 @@
// See LICENSE for license details.
#ifndef _RISCV_ENTROPY_SOURCE_H
#define _RISCV_ENTROPY_SOURCE_H
#include <fstream>
#include <iostream>
@ -116,3 +120,4 @@ public:
};
#endif

5
softfloat/softfloat.mk.in

@ -243,8 +243,3 @@ softfloat_test_srcs =
softfloat_install_hdrs = \
softfloat.h \
softfloat_types.h \
primitives.h \
internals.h \
platform.h \
primitiveTypes.h \
specialize.h \

Loading…
Cancel
Save