Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions checkBitSize/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# checkBitSize
This little program tells you the size of size_t and void*
# Compilation
## Linux
On Linux, just run gcc on your platform:

`gcc -o checkbitsize checkBitSize.c`

Some examples for cross-compiling:

arm: `arm-linux-gnueabihf-gcc -o checkbitsize checkBitSize.c`

i386: `gcc -m32 -o checkbitsize checkBitSize.c`

## Windows
For MSVC, the targets Win32 and x64 are provided in the solution file. Examples:

`/path/to/MSBuild.exe build/MSVC/checkBitSize.sln //t:Rebuild //p:Configuration=Release //p:Platform=Win32`

`/path/to/MSBuild.exe build/MSVC/checkBitSize.sln //t:Rebuild //p:Configuration=Release //p:Platform=x64`
28 changes: 28 additions & 0 deletions checkBitSize/build/MSVC/checkBitSize.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "checkBitSize", "checkBitSize.vcxproj", "{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Debug|Win32.ActiveCfg = Debug|Win32
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Debug|Win32.Build.0 = Debug|Win32
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Debug|x64.ActiveCfg = Debug|x64
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Debug|x64.Build.0 = Debug|x64
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Release|Win32.ActiveCfg = Release|Win32
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Release|Win32.Build.0 = Release|Win32
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Release|x64.ActiveCfg = Release|x64
{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
186 changes: 186 additions & 0 deletions checkBitSize/build/MSVC/checkBitSize.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{18A05DED-E49F-4BFC-BE57-E27A7AFB0C12}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>checkBitSize</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>EnableAllWarnings</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>
</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<DisableSpecificWarnings>4820;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>EnableAllWarnings</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>
</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<DisableSpecificWarnings>4820;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>
</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<DisableSpecificWarnings>4820;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>EnableAllWarnings</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>
</PreprocessorDefinitions>
<CompileAs>CompileAsC</CompileAs>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<DisableSpecificWarnings>4820;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\checkBitSize.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\checkBitSize.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
27 changes: 27 additions & 0 deletions checkBitSize/build/MSVC/checkBitSize.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\checkBitSize.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\checkBitSize.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions checkBitSize/checkBitSize.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* Sebastian Burkhart, 2019 */
#include "checkBitSize.h"

int main(void)
{
const size_t targetSize = TARGET_SIZE;
const char* const result[] = { "error", "success" };
const int success = sizeof(size_t) == targetSize && sizeof(void*) == targetSize;
fprintf( success ? stdout : stderr, "%s! compiled for %s. size_t = " SIZE_T_FORMAT_STRING " bits, void* = " SIZE_T_FORMAT_STRING " bits. " SIZE_T_FORMAT_STRING " bits expected.\n", result[success], PLATFORM, SIZE_T_CAST(8*sizeof(size_t)), SIZE_T_CAST(8*sizeof(void*)), SIZE_T_CAST(8*targetSize));
MSVC_DEBUG_PAUSE;
return success ? EXIT_SUCCESS : EXIT_FAILURE;
}
50 changes: 50 additions & 0 deletions checkBitSize/checkBitSize.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* Sebastian Burkhart, 2019 */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include "../../data-compressor/DataCompressor/common/inc/io.h"

#define BITS_32 4
#define BITS_64 8

#if defined __GNUC__
#if defined __i386
#define TARGET_SIZE BITS_32
#define PLATFORM "i386 linux"
#elif defined __x86_64
#define TARGET_SIZE BITS_64
#define PLATFORM "x86_64 linux"
#elif defined __arm__
#define TARGET_SIZE BITS_32
#define PLATFORM "arm linux"
#elif defined __aarch64__
#define TARGET_SIZE BITS_64
#define PLATFORM "arm (64 bit) linux"
#else
#define PLATFORM "invalid"
#error "unsupported architecture"
#endif
#elif defined _MSC_VER && _MSC_VER >= 1800
#if defined _WIN64 && !defined _M_ARM
#define TARGET_SIZE BITS_64
#define PLATFORM "win64"
#elif defined _WIN32 && !defined _M_ARM
#define TARGET_SIZE BITS_32
#define PLATFORM "win32"
#else
#define PLATFORM "invalid"
#error "unsupported architecture"
#endif
#else
#define PLATFORM "invalid compiler"
#error "unsupported compiler"
#endif

#define SIZE_T_FORMAT_STRING "%" SIZE_T_FORMAT

#if defined _DEBUG && defined _MSC_VER
#define MSVC_DEBUG_PAUSE system("pause")
#else
#define MSVC_DEBUG_PAUSE
#endif
38 changes: 38 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Tests for the data-compressor
This folder contains automated tests for the [Data Compressor](https://github.com/CenterForSecureEnergyInformatics/data-compressor)
The tests can be used manually, but are intended for a CI system (buildbot).
The proper environment for building and testing is chosen automatically.

## prerequisites
On Windows, you have to have installed:
- Git including Git Bash. Download the current version here: https://git-scm.com/download/win
- Microsoft C++ Build Tools 2019. Download: https://visualstudio.microsoft.com/de/downloads/

On Linux, you need gcc for your platform.
Currently, the versions shipped with Raspian / Ubuntu 18.04 / Alpine are used.

The source files for the [Data Compressor](https://github.com/CenterForSecureEnergyInformatics/data-compressor) and [checkBitSize](../checkBitSize) have to be next to the folder containing ths project.
Other locations can be specified via the variables `checkBitSizePath` and `dataCompressorPath` in the scripts.

## buildAndTest.sh

- Linux `buildAndTest.sh <i386|x86_64|armhf|arm|win32|x64> <IO_SIZE_BITS>`
- Raspberry Pi `buildAndTest.sh arm <IO_SIZE_BITS>`
- Windows `buildAndTest.sh <win32|x64> <IO_SIZE_BITS>`

First, the [Data Compressor](https://github.com/CenterForSecureEnergyInformatics/data-compressor) is built for the platform specified via the first argument.
The second argument specifies `IO_SIZE_BITS`.

After compilation, testdata (contained in the data-compressor repository) is compressed and decompressed with the following methods:
- dega
- lzmh

The resulting data is compared to the input via diff.
If input and output differs for some tests, the script will return an error.

## checkBits.sh
- Linux `checkBits.sh <i386|x86_64|armhf|arm|win32|x64>`
- Raspberry Pi: `checkBits.sh arm`
- Windows: `checkBits.sh <win32|x64>`

This script compiles and runs the program [checkBitSize](../checkBitSize) on the specified platform.
Loading