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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@
# Built documentation
doc/_build/pdf/*.pdf
**/doc/pdf/*.pdf


tests/pytest_result.xml
tests/xrun.lock
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "submodules/SP800-90B_EntropyAssessment"]
path = submodules/SP800-90B_EntropyAssessment
url = git@github.com:xmos/SP800-90B_EntropyAssessment.git
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM gcc:15-bookworm

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libbz2-dev libdivsufsort-dev libjsoncpp-dev libssl-dev libmpfr-dev
239 changes: 157 additions & 82 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,100 +1,175 @@
// This file relates to internal XMOS infrastructure and should be ignored by external users

@Library('xmos_jenkins_shared_library@v0.43.0') _

getApproval()

pipeline {
agent none

options {
buildDiscarder(xmosDiscardBuildSettings())
skipDefaultCheckout()
timestamps()
}

parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.3.1',
description: 'The XTC tools version'
)
string(
name: 'XMOSDOC_VERSION',
defaultValue: 'v8.0.0',
description: 'The xmosdoc version'
)
string(
name: 'INFR_APPS_VERSION',
defaultValue: 'v3.1.1',
description: 'The infr_apps version'
)
}
agent none

stages {
stage('🏗️ Build and test') {
agent {
label 'x86_64 && linux && documentation'
}
parameters {
string(
name: 'TOOLS_VERSION',
defaultValue: '15.3.1',
description: 'XTC tools version'
)
string(
name: 'XMOSDOC_VERSION',
defaultValue: 'v7.4.0',
description: 'xmosdoc version'
)
string(
name: 'INFR_APPS_VERSION',
defaultValue: 'v3.1.1',
description: 'The infr_apps version'
)
}

stages {
stage('Build') {
steps {
options {
skipDefaultCheckout()
timestamps()
buildDiscarder(xmosDiscardBuildSettings(onlyArtifacts = false))
}

println "Stage running on ${env.NODE_NAME}"
stages {
stage('🏗️ Build & Test') {
parallel {
stage('🏗️ Build and sim tests') {
agent { label 'x86_64 && linux && documentation' }
stages {
stage('Checkout') {
steps {
println "Stage running on ${env.NODE_NAME}"
script {
def (server, user, repo) = extractFromScmUrl()
env.REPO_NAME = repo
}
dir(REPO_NAME) {
checkoutScmShallow()
}
}
}

script {
def (server, user, repo) = extractFromScmUrl()
env.REPO_NAME = repo
}
stage('Examples build') {
steps {
dir("${REPO_NAME}/examples") {
xcoreBuild()
}
}
}

dir(REPO_NAME) {
checkoutScmShallow()
stage('Repo checks') {
steps {
warnError("Repo checks failed") {
runRepoChecks("${WORKSPACE}/${REPO_NAME}")
}
}
}

withTools(params.TOOLS_VERSION) {
dir("examples") {
xcoreBuild()
}
}
}
}
} // Build
stage('Doc build') {
steps {
dir(REPO_NAME) {
buildDocs()
}
}
}

stage('Library checks') {
steps {
warnError("Repo checks failed") {
runRepoChecks("${WORKSPACE}/${REPO_NAME}")
}
}
}
stage('Sim tests') {
steps {
dir("${REPO_NAME}/tests") {
withTools(params.TOOLS_VERSION) {
createVenv(reqFile: "requirements.txt")
withVenv {
xcoreBuild(archiveBins: false)
sh "pytest -k _xsim -vv -n auto --junitxml=pytest_result.xml"
}
}
}
junit "${REPO_NAME}/tests/**/pytest_*.xml"
}
}

stage('Documentation') {
steps {
dir(REPO_NAME) {
buildDocs()
}
}
}
stage("Archive sandbox") {
steps {
archiveSandbox(REPO_NAME)
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage Build and test

stage('🏗️ Build and hardware tests') {
agent { label 'xcore.ai' }
stages {
stage('Checkout') {
steps {
println "Stage running on ${env.NODE_NAME}"
script {
def (server, user, repo) = extractFromScmUrl()
env.REPO_NAME = repo
}
dir(REPO_NAME) {
checkoutScmShallow()
sh 'git submodule update --init --recursive --depth 1'
}
}
}
stage('Build Analysis SW') {
agent {
dockerfile {
filename "${REPO_NAME}/Dockerfile"
reuseNode true
}
}
steps {
dir("${REPO_NAME}/submodules/SP800-90B_EntropyAssessment/cpp") {
sh '(cd /lib/x86_64-linux-gnu; tar cf - libdivsu*) | tar xf -'
sh 'make -k'
}
}
}

stage("Archive sandbox") {
steps {
archiveSandbox(REPO_NAME)
}
stage('Verif HW random') {
steps {
dir("${REPO_NAME}/tests") {
withTools(params.TOOLS_VERSION) {
createVenv(reqFile: "requirements.txt")
withVenv {
xcoreBuild(archiveBins: false)
sh "pytest -k _hw -vv -s test_hw.py --junitxml=pytest_result.xml"
}
}
}
junit "${REPO_NAME}/tests/**/pytest_*.xml"
}
}

stage("Archive sandbox") {
steps {
archiveSandbox(REPO_NAME)
}
}
}
post {
cleanup {
xcoreCleanSandbox()
}
}
} // stage Test HW
} // parallel
}

} // stages
post {
cleanup {
xcoreCleanSandbox()
stage('🚀 Release') {
when {
expression { triggerRelease.isReleasable() }
}
steps {
triggerRelease()
}
}
}
} // stage 'Build and test'

stage('🚀 Release') {
when {
expression { triggerRelease.isReleasable() }
}
steps {
triggerRelease()
}
}
}
}
} // pipeline
2 changes: 1 addition & 1 deletion examples/app_random/src/main.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2025 XMOS LIMITED.
// Copyright 2016-2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <stdint.h>
#include <print.h>
Expand Down
2 changes: 1 addition & 1 deletion lib_random/api/random.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2025 XMOS LIMITED.
// Copyright 2016-2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#ifndef _RANDOM_H_
#define _RANDOM_H_
Expand Down
4 changes: 2 additions & 2 deletions lib_random/src/pr_random.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2016-2025 XMOS LIMITED.
// Copyright 2016-2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <xs1.h>
#include "random.h"
#include "random_internal.h"

#define crc32(a,b,c) asm("crc32 %0, %1, %2" : "+r" (a) : "r" (c), "r" (b))
#define crc32(a,b,c) asm("crc32 %0, %1, %2" : "+r" (a) : "r" (b), "r" (c))

static const unsigned random_poly = 0xEDB88320;

Expand Down
2 changes: 1 addition & 1 deletion lib_random/src/random_init.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2025 XMOS LIMITED.
// Copyright 2016-2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <xs1.h>
#include "random.h"
Expand Down
2 changes: 1 addition & 1 deletion lib_random/src/random_internal.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024-2025 XMOS LIMITED.
// Copyright 2024-2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#ifndef __random_internal_h__
Expand Down
2 changes: 1 addition & 1 deletion lib_random/src/ro_random.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018-2025 XMOS LIMITED.
// Copyright 2018-2026 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.
#include <xs1.h>
#include <xcore/hwtimer.h>
Expand Down
1 change: 1 addition & 0 deletions submodules/SP800-90B_EntropyAssessment
7 changes: 7 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.21)
include($ENV{XMOS_CMAKE_PATH}/xcommon.cmake)
project(lib_crypto_tests)

add_subdirectory(test_pr)
add_subdirectory(test_ro)

17 changes: 17 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2025-2026 XMOS LIMITED.
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
import pytest

@pytest.fixture
def level(request):
return request.config.getoption("--level")

def pytest_addoption(parser):

parser.addoption(
"--level",
action="store",
default="smoke",
choices=["smoke", "default", "extended"],
help="Test coverage level",
)
37 changes: 37 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# python_version 3.12.1
# pip_version 24.*
#
# The parse_version_from_requirements() function in the installPipfile.groovy
# file of the Jenkins Shared Library uses the python_version comment to set
# the version of python used.

# Distributed (released) dependencies
#
# The python modules listed below specify a known working combination required
# by the python code in this repository. The procedure used to set up a
# suitable python environment for it installs the version of each module in
# the list. Using a specific version ensures a controlled infrastructure for
# development, testing and release of this repository.
#
# Another repository might depend on python code defined in this one. The
# procedure to set up a suitable python environment for that repository may
# pip-install this one as editable using this repository's setup.py file. The
# same modules should appear in the setup.py list as given below.
pytest==8.3.3
pytest-xdist==3.6.1
filelock==3.19.1

# Development dependencies
#
# Each link listed below specifies the path to a setup.py file which are
# installed in editable mode with '-e $PATH' (without the quotes).
#
# If python code in this repository depends on python code under development
# in another repository, then an entry for that other respository should
# appear in this list instead of the released dependencies list.
#
# If this repository uses the setup functionality (e.g., script entry points)
# of its own setup.py file, then this list must include an entry for that
# setup.py file, e.g., '-e .' or '-e ./python' (without the quotes).

-e git+ssh://git@github.com/xmos/test_support.git@v2.0.0#egg=test_support
Loading