name: stress-ng
summary: tool to load and stress a computer
description: stress-ng can stress various subsystems of a computer.  It can stress load CPU, cache, disk, memory, socket and pipe I/O, scheduling and much more.  stress-ng is a re-write of the original stress tool by Amos Waterland but has many additional features such as specifying the number of bogo operations to run, execution metrics, a stress verification on memory and compute operations and considerably more stress mechanisms.
confinement: strict
grade: stable
type: app
base: core18
assumes: [snapd2.37]
adopt-info: stress-ng

architectures:
    - build-on: s390x
    - build-on: ppc64el
    - build-on: arm64
    - build-on: armhf
    - build-on: amd64
    - build-on: i386

environment:
    CFLAGS: '-fstack-protector-strong -Wformat -Werror=format-security'
    LDFLAGS: Wl,-z,relro

parts:
    stress-ng:
        plugin: make
        source: git://kernel.ubuntu.com/cking/stress-ng
        override-pull: |
            snapcraftctl pull
            description="$(git describe HEAD --tags)"
            sha=$(echo $description | tr '-' ' ' | awk '{print $NF}')
            version=${description%$sha}
            commits=$(git log --oneline | wc -l)
            date=$(date +'%Y%m%d')
            if test "$description" = "$sha"
            then
                version="$description"
            else
                version=$(echo $version$date-$commits-$sha | cut -c1-32)
            fi
            snapcraftctl set-version "$version"
        make-parameters:
            - STATIC=1
        build-packages:
            - gcc
            - make
            - zlib1g-dev
            - libbsd-dev
            - libgcrypt20-dev
            - libkeyutils-dev
            - libapparmor-dev
            - libaio-dev
            - libcap-dev
            - libsctp-dev
            - libjudy-dev
apps:
    stress-ng:
        plugs: [ home, log-observe, system-observe, hardware-observe, system-trace, hardware-random-observe ]
        command: usr/bin/stress-ng

