Skip to content

Commit

Permalink
feat!: Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminbruun committed Feb 21, 2024
0 parents commit 1e956d0
Show file tree
Hide file tree
Showing 241 changed files with 22,146 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: C/C++ CI

on:
push:
branches:
- "**"


jobs:
build-and-test:

runs-on: ubuntu-latest


steps:
- uses: actions/checkout@v2

- name: Setup build
run: autoreconf -i --force && ./configure --enable-sanitize --enable-werror

- name: Run tests
run: make check

- name: Make all
run: make all

- uses: actions/checkout@v2
with:
repository: frankmorgner/vsmartcard
path: vsmartcard

- name: Setup VPCD
run: sudo apt install libpcsclite-dev && sudo apt install help2man && cd vsmartcard/virtualsmartcard && autoreconf --verbose --install --force && sudo ./configure --sysconfdir=/etc && sudo make && sudo make install

# make sure the server is running...
- name: make sure virtual card reader can be reached
run: sudo apt install pcscd && sudo systemctl start pcscd

- uses: actions/checkout@v2
with:
repository: onomondo/onomondo-softsim-test-suite
submodules: recursive
path: softsim-tests
token: ${{ secrets.GH_AUTH_TOKEN }}

- uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install test suite (esp. pysim) requirements
run: |
set -e
git clone https://gitea.osmocom.org/sim-card/pysim.git $GITHUB_WORKSPACE/pysim
pip3 install -r $GITHUB_WORKSPACE/softsim-tests/requirements.txt
# Shouldn't be any additional ones, but running it anyway in case upstream changes them
pip3 install -r $GITHUB_WORKSPACE/pysim/requirements.txt
- name: Remove files before restoring them
run: git rm -rf files/3f00 files/3f00.def && mkdir files

- name: Start soft sim
run: cd $GITHUB_WORKSPACE/ && src/softsim/softsim &

- name: Restore files and verify their identity of restored with original files
run: |
set -e
./pysim/pySim-shell.py -p0 --script ./files-creation/all.pysim
git add files
git diff --cached --exit-code
- name: Run python-test suite
run: |
set -e
cd $GITHUB_WORKSPACE/softsim-tests/
# Note that this only logs, and is expected to fail (but does not report that in its error code)
python test_SIM_OS.py
- name: Stop soft sim (standalone version brings its own execution management)
# It takes some time for VPCD to be ready again
run: pkill -f softsim -USR1 && sleep 1

- name: Install libosmocore-utils (necessary for testing Milenage)
run: sudo apt-get install -y --no-install-recommends libosmocore-utils

- name: Run python-test suite (standalone version)
run: |
cd $GITHUB_WORKSPACE/softsim-tests/
SOFTSIM_TEST_RUNNER=execute_softsim PYTHONPATH=./pysim SOFTSIM=../src/softsim/softsim python3 -m unittest -v
33 changes: 33 additions & 0 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI/CD for CMAKE Project

on:
push:
branches:
- "**"

jobs:
cmake-build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4

- name: Install CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.27.0
ninjaVersion: 1.11.1

- name: Install Embedded Toolchain
uses: carlosperate/[email protected]

- name: Configure and Build Project
run: |
cmake -S . -B build -DBUILD_TESTING=y -DCONFIG_USE_SYSTEM_HEAP=y
cmake --build build
- name: Test Project
run: cd build && ctest

- name: Install Project
run: cd build && make install
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
*.o
*.lo
*.a
.deps
Makefile
Makefile.in
config.h
config.h.in
*.pc
*~

*.*~
*.sw?
.libs
*.pyc
*.gcda
*.gcno

**/TAGS

#configure
aclocal.m4
autom4te.cache/
config.log
config.status
config.guess
config.sub
configure
compile
depcomp
install-sh
missing
stamp-h1
libtool
ltmain.sh
m4/*.m4

#tests
tests/testsuite.dir
tests/*/*_test

tests/atconfig
tests/atlocal
tests/package.m4
tests/testsuite
tests/testsuite.log

writtenconfig/

#binary
src/softsim/softsim

# Mac OS X
.DS_Store
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/settings.json
36 changes: 36 additions & 0 deletions BSD-3-Clause
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Valid-License-Identifier: BSD-3-Clause
SPDX-URL: https://spdx.org/licenses/BSD-3-Clause.html
Usage-Guide:
To use the BSD 3-clause "New" or "Revised" License put the following SPDX
tag/value pair into a comment according to the placement guidelines in
the licensing rules documentation:
SPDX-License-Identifier: BSD-3-Clause
License-Text:

Copyright (c) <year> <owner> . All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
40 changes: 40 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2024 Onomondo ApS. All rights reserved.
# SPDX-License-Identifier: GPL-3.0-only

cmake_minimum_required(VERSION 3.13...3.19 FATAL_ERROR)

project(softsim
VERSION 1.0.0
LANGUAGES C
)

option(CONFIG_USE_SYSTEM_HEAP "Use free/malloc instead of port_free/port_malloc" OFF)

if(CONFIG_USE_SYSTEM_HEAP)
add_compile_definitions(-DCONFIG_USE_SYSTEM_HEAP)
endif()

add_subdirectory(src)

install(TARGETS storage uicc milenage crypto
CONFIGURATIONS Debug
ARCHIVE DESTINATION ${CMAKE_SOURCE_DIR}/lib_${TARGET_CPU}/Debug
PUBLIC_HEADER DESTINATION ${CMAKE_SOURCE_DIR}/lib_${TARGET_CPU}/include
)

install(TARGETS storage uicc milenage crypto
CONFIGURATIONS Release
ARCHIVE DESTINATION ${CMAKE_SOURCE_DIR}/lib_${TARGET_CPU}/Release/
PUBLIC_HEADER DESTINATION ${CMAKE_SOURCE_DIR}/lib_${TARGET_CPU}/include
)

install(TARGETS storage uicc milenage crypto
CONFIGURATIONS MinSizeRel
ARCHIVE DESTINATION ${CMAKE_SOURCE_DIR}/lib_${TARGET_CPU}/ReleaseOs/
PUBLIC_HEADER DESTINATION ${CMAKE_SOURCE_DIR}/lib_${TARGET_CPU}/include
)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
include(CTest)
add_subdirectory(tests)
endif()
Loading

0 comments on commit 1e956d0

Please sign in to comment.