From d7533b611eeb05ba6eb31eed76c2dce644fad952 Mon Sep 17 00:00:00 2001 From: Serhii Turivny Date: Nov 20 2017 12:43:10 +0000 Subject: Add tests for Localhost Container and Atomic --- diff --git a/tests/long-filename/Makefile b/tests/long-filename/Makefile new file mode 100644 index 0000000..f94a182 --- /dev/null +++ b/tests/long-filename/Makefile @@ -0,0 +1,59 @@ +# Example Makefile for RHTS +# This example is geared towards a test for a specific package +# It does most of the work for you, but may require further coding + +# The toplevel namespace within which the test lives. +# FIXME: You will need to change this: +TOPLEVEL_NAMESPACE=/CoreOS + +# The name of the package under test: +# FIXME: you wil need to change this: +PACKAGE_NAME=unzip + +# The path of the test below the package: +# FIXME: you wil need to change this: +RELATIVE_PATH=long-filenames + +# Version of the Test. Used with make tag. +export TESTVERSION=1.0 + +# The compiled namespace of the test. +export TEST=$(TOPLEVEL_NAMESPACE)/$(PACKAGE_NAME)/$(RELATIVE_PATH) + +.PHONY: all install download clean + +BUILT_FILES= # executables to be built should be added here, they will be generated on the system under test. +FILES=$(METADATA) \ + runtest.sh \ + Makefile + +run: $(FILES) #build + ./runtest.sh + +build: $(BUILT_FILES) + chmod a+x ./runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + +# You may need to add other taregts e.g. to build executables from source code +# Add them here: + + +# Include Common Makefile +include /usr/share/rhts/lib/rhts-make.include + +# Generate the testinfo.desc here: +$(METADATA): Makefile + @touch $(METADATA) + @echo "Owner: Petr Muller " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Description: unzip do not crash with filename too long." >> $(METADATA) + @echo "TestTime: 1m" >> $(METADATA) + @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) +# You may need other fields here; see the documentation diff --git a/tests/long-filename/runtest.sh b/tests/long-filename/runtest.sh new file mode 100644 index 0000000..7fc5ce4 --- /dev/null +++ b/tests/long-filename/runtest.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# source the test script helpers +. /usr/bin/rhts_environment.sh + + +# ----------------------- +RESULT=FAIL + +exec 6>&1 +exec &>$OUTPUTFILE + +unzip `perl -e 'print "A" x 50000'` && rc=$? || rc=$? +if [ "$rc" -eq 10 ] +then + RESULT=PASS + echo "\ + " + echo "RHTS> filename processed ok, no segmentation problems => PASS" +else + echo "\ + " + echo "RHTS> some segmentation problems occured => FAIL" +fi + +exec 1>&6 + +# Then file the results in the database +report_result "${TEST}" "${RESULT}" diff --git a/tests/roles/preconditions/tasks/main.yml b/tests/roles/preconditions/tasks/main.yml new file mode 100644 index 0000000..b66d677 --- /dev/null +++ b/tests/roles/preconditions/tasks/main.yml @@ -0,0 +1,11 @@ +--- + +- name: install perl + shell: rpm-ostree install perl && rpm-ostree ex livefs + register: command_result + ignore_errors: yes + +- name: install unzip + shell: rpm-ostree install unzip && rpm-ostree ex livefs + register: command_result + ignore_errors: yes diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..1e3f9c5 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,22 @@ +--- +# Tests that run in classic context +- hosts: localhost + tags: + - classic + - container + roles: + - role: standard-test-beakerlib + tests: + - long-filename + required_packages: + - findutils # beakerlib needs find command + - perl # long-filename needs perl + - unzip +- hosts: localhost + tags: + - atomic + roles: + - role: preconditions + - role: standard-test-beakerlib + tests: + - long-filename