未验证 提交 5e74a88d 编写于 作者: W wanderingbort 提交者: GitHub

Merge pull request #1367 from EOSIO/stltest-cleanup

Stltest cleanup
......@@ -489,7 +489,9 @@ void* malloc(size_t size)
void* calloc(size_t count, size_t size)
{
return eosio::memory_heap.malloc(count*size);
void* ptr = eosio::memory_heap.malloc(count*size);
memset(ptr, 0, count*size);
return ptr;
}
void* realloc(void* ptr, size_t size)
......
Subproject commit 35a26f82dae8b292290815ae6ede8f849ce7806f
Subproject commit 959b01fb8b617851e260bd2218ac8ba74269fec9
......@@ -4,18 +4,23 @@ file(GLOB ENV_SOURCES "upstream/src/env/*.c")
file(GLOB ERRNO_SOURCES "upstream/src/errno/*.c")
file(GLOB EXIT_SOURCES "upstream/src/exit/*.c")
file(GLOB LOCALE_SOURCES "upstream/src/locale/*.c")
file(GLOB MALLOC_SOURCES "upstream/src/malloc/*.c")
file(GLOB MBYTE_SOURCES "upstream/src/multibyte/*.c")
file(GLOB MISC_SOURCES "upstream/src/misc/*.c")
file(GLOB SEARCH_SOURCES "upstream/src/search/*.c")
file(GLOB STDIO_SOURCES "upstream/src/stdio/*.c")
file(GLOB STDLIB_SOURCES "upstream/src/stdlib/*.c")
file(GLOB STRING_SOURCES "upstream/src/string/*.c")
file(GLOB TIME_SOURCES "upstream/src/time/*.c")
file(GLOB THREAD_SOURCES "upstream/src/thread/*.c") #only for __lock __unlock
file(GLOB INTERNAL_SOURCES upstream/src/internal/intscan.c upstream/src/internal/shgetc.c upstream/src/internal/libc.c)
set(INTERNAL_SOURCES upstream/src/internal/intscan.c upstream/src/internal/shgetc.c upstream/src/internal/libc.c)
add_wast_library(TARGET libc
SOURCE_FILES ${CRYPT_SOURCES} ${CTYPE_SOURCES} ${ENV_SOURCES} ${ERRNO_SOURCES} ${EXIT_SOURCES} ${INTERNAL_SOURCES} ${LOCALE_SOURCES} ${MBYTE_SOURCES}
${SEARCH_SOURCES} ${STDIO_SOURCES} ${STDLIB_SOURCES} ${STRING_SOURCES} ${TIME_SOURCES} ${THREAD_SOURCES}
INCLUDE_FOLDERS ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/include ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/src/internal ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/arch/eos ${CMAKE_SOURCE_DIR}/contracts/
${MISC_SOURCES} ${SEARCH_SOURCES} ${STDIO_SOURCES} ${STDLIB_SOURCES} ${STRING_SOURCES} ${TIME_SOURCES} ${THREAD_SOURCES}
INCLUDE_FOLDERS ${CMAKE_SOURCE_DIR}/contracts/musl/upstream/include
${CMAKE_SOURCE_DIR}/contracts/musl/upstream/src/internal
${CMAKE_SOURCE_DIR}/contracts/musl/upstream/arch/eos
${CMAKE_SOURCE_DIR}/contracts/
DESTINATION_FOLDER ${CMAKE_CURRENT_BINARY_DIR}
)
Subproject commit 29098b1f3044e7a9e2c1152028dba08885ea04f9
Subproject commit ee49ba896db1de3c3e4f4285eb4e285b641a6cd9
......@@ -6,17 +6,13 @@
// include entire libc
#include <alloca.h>
#include <ar.h>
#include <assert.h>
#include <byteswap.h>
#include <cpio.h>
#include <crypt.h>
#include <ctype.h>
#include <elf.h>
#include <endian.h>
#include <errno.h>
#include <features.h>
#include <fnmatch.h>
#include <inttypes.h>
#include <iso646.h>
#include <limits.h>
......@@ -25,8 +21,6 @@
#include <math.h>
#include <memory.h>
#include <monetary.h>
#include <mqueue.h>
#include <regex.h>
#include <search.h>
#include <stdalign.h>
#include <stdarg.h>
......@@ -39,15 +33,11 @@
#include <stdnoreturn.h>
#include <string.h>
#include <strings.h>
#include <stropts.h>
#include <sysexits.h>
#include <tar.h>
#include <uchar.h>
#include <unistd.h>
#include <values.h>
#include <wchar.h>
#include <wctype.h>
#include <wordexp.h>
//include entire libstdc++
#include<algorithm>
......@@ -201,6 +191,10 @@ namespace stltest {
}
};
static void f(const char* __restrict, ...) {
prints("f() called\n");
}
static void on(const message& msg) {
/* manual initialization of global variable
new(&std::__start_std_streams)std::ios_base::Init;
......@@ -216,8 +210,16 @@ namespace stltest {
prints("\nEOS string: "); prints_l(s2.get_data(), s2.get_size());
*/
prints("STL test start\n");
/* doesn't work with WASM::serializeWithInjection
printf("stdout output\n", 0);
fprintf(stderr, "stderr output\n", 0);
*/
void* ptr = malloc(10);
free(ptr);
f("abc", 10, 20);
//auto mptr = new MSTR();
//delete mptr;
std::array<uint32_t, 10> arr;
arr.fill(3);
......
......@@ -8,6 +8,8 @@ target_link_libraries( txn_test_gen_plugin appbase fc http_plugin chain_plugin )
target_include_directories( txn_test_gen_plugin PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )
target_include_directories( txn_test_gen_plugin PUBLIC ${CMAKE_BINARY_DIR}/contracts )
add_dependencies( txn_test_gen_plugin currency)
install( TARGETS
txn_test_gen_plugin
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册