From 0207f7189499be332224e39bccc6f954de3c9784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 21 Jan 2004 15:54:53 +0000 Subject: [PATCH] Added a simple test program to check if the disk structure sizes change with different compiler options - couldn't find anything, though. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6213 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../file_systems/bfs/structureSizes/Jamfile | 22 +++++++++++ .../bfs/structureSizes/structureSizes.cpp | 37 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile create mode 100644 src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp diff --git a/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile new file mode 100644 index 0000000000..959ccdd493 --- /dev/null +++ b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/Jamfile @@ -0,0 +1,22 @@ +SubDir OBOS_TOP src tests add-ons kernel file_systems bfs structureSizes ; + +SubDirHdrs $(OBOS_TOP) src add-ons kernel file_systems bfs ; + +{ + local defines = [ FDefines USER ] ; # _NO_INLINE_ASM + SubDirCcFlags $(defines) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage + SubDirC++Flags $(defines) -fno-exceptions -fno-rtti ; #-fcheck-memory-usage +} + +# To check the effects of different compiler options to the structures +# without _PACKED use: +# $ OPTIM=-Ox DEBUG=0 NO_TEST_DEBUG=1 jam -a + +SimpleTest structureSizes + : structureSizes.cpp + : ; + +# Tell Jam where to find these sources +SEARCH on [ FGristFiles BufferPool.cpp ] + = [ FDirName $(OBOS_TOP) src add-ons kernel file_systems bfs ] ; + diff --git a/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp new file mode 100644 index 0000000000..cd326688eb --- /dev/null +++ b/src/tests/add-ons/kernel/file_systems/bfs/structureSizes/structureSizes.cpp @@ -0,0 +1,37 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include + +#undef _PACKED +#define _PACKED + +#include "bfs.h" + +#include +#include + + +#define SIZEOF(x) "%20s = %lu\n", #x, sizeof(x) +#define OFFSETOF(x, y) #x "." #y " at offset %lu\n", offsetof(x, y) + + +int +main(int argc, char **argv) +{ + printf(SIZEOF(disk_super_block)); + printf(SIZEOF(small_data)); + printf(SIZEOF(data_stream)); + printf(SIZEOF(bfs_inode)); + + puts(""); + + printf(OFFSETOF(bfs_inode, inode_size)); + printf(OFFSETOF(bfs_inode, etc)); + printf(OFFSETOF(bfs_inode, data)); + + return 0; +}