#24 Set up CI gating
Closed 2 years ago by codonell. Opened 3 years ago by mcermak.
Unknown source master  into  rawhide

file added
+1
@@ -0,0 +1,1 @@

+ 1

file added
+13
@@ -0,0 +1,13 @@

+ --- !Policy

+ product_versions:

+   - fedora-*

+ decision_context: bodhi_update_push_stable

+ subject_type: koji_build

+ rules:

+   - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

+ --- !Policy

+ product_versions:

+   - rhel-9

+ decision_context: osci_compose_gate

+ rules:

+   - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional}

file added
+6
@@ -0,0 +1,6 @@

+ summary: CI Gating Plan

+ discover:

+     how: fmf

+     directory: tests

+ execute:

+     how: beakerlib

@@ -0,0 +1,21 @@

+ #include <stdio.h>

+ #include <stdlib.h>

+ #include <string.h>

+ 

+ int main(){

+   char one[] = "Whatever!";

+   char *two;

+   FILE *fp = fopen("lc.out", "w");

+ 

+   fprintf(fp, "Printf: %d\n", 10);

+   fprintf(fp, "Whatever: %s, length %d\n", one, strlen(one));

+ 

+   two = malloc(sizeof(char) * 20);

+   memcpy(two, one, 3);

+   two[3] = '\0';

+   fprintf(fp, "Two: %s, length %d\n", two, strlen(two));

+ 

+   close(fp);

+   free(two);

+   return 0;

+ }

@@ -0,0 +1,3 @@

+ Printf: 10

+ Whatever: Whatever!, length 9

+ Two: Wha, length 3

@@ -0,0 +1,13 @@

+ #include <stdio.h>

+ #include <math.h>

+ 

+ int main(){

+   FILE *fp = fopen("lm.out", "w");

+   double a = pow(10, 2);

+   fprintf(fp, "POW: %0.2f\n", a);

+   fprintf(fp, "SIN: %0.2f\n", 1.0);

+ 

+ 

+   close(fp);

+   return 0;

+ }

@@ -0,0 +1,2 @@

+ POW: 100.00

+ SIN: 1.00

@@ -0,0 +1,46 @@

+ #include <pthread.h>

+ #include <stdio.h>

+ 

+ FILE *fp;

+ pthread_mutex_t mutech = PTHREAD_MUTEX_INITIALIZER;

+ pthread_cond_t cond = PTHREAD_COND_INITIALIZER;

+ int counter = 0;

+ 

+ void *one(void *arg){

+   pthread_mutex_lock(&mutech);

+   while (counter == 0)

+     pthread_cond_wait(&cond, &mutech);

+ 

+   counter = 2;

+   fprintf(fp, "Thread 1 run\n");

+ 

+   pthread_mutex_unlock(&mutech);

+   pthread_cond_signal(&cond);

+ }

+ 

+ void *two(void *arg){

+   pthread_mutex_lock(&mutech);

+   while(counter == 1)

+     pthread_cond_wait(&cond, &mutech);

+ 

+   counter = 1;

+   fprintf(fp, "Thread 2 run\n");

+ 

+   pthread_mutex_unlock(&mutech);

+   pthread_cond_signal(&cond);

+ }

+ 

+ 

+ int main(){

+   fp = fopen("lpthread.out", "w");

+   pthread_t on;

+   pthread_t tw;

+   pthread_create(&on, NULL, one, NULL);

+   pthread_create(&tw, NULL, two, NULL);

+ 

+   pthread_join(tw, NULL);

+   pthread_join(on, NULL);

+ 

+   close(fp);

+   return 0;

+ }

@@ -0,0 +1,2 @@

+ Thread 2 run

+ Thread 1 run

@@ -0,0 +1,21 @@

+ #include <stdio.h>

+ #include <fcntl.h>

+ 

+ int main(){

+   FILE *fp = fopen("lrt.out", "w");

+ 

+   int opn = shm_open("/stuffz0r", O_RDWR|O_CREAT, 0777);

+   if ( opn == -1 )

+     fprintf(fp, "shm_open failed\n");

+   else

+     fprintf(fp, "shm_open successful\n");

+ 

+   int unl = shm_unlink("/stuffz0r");

+   if ( unl == -1 )

+     fprintf(fp, "shm_unlink failed\n");

+   else

+     fprintf(fp, "shm_unlink successful\n");

+ 

+   close(fp);

+   return 0;

+ }

@@ -0,0 +1,2 @@

+ shm_open successful

+ shm_unlink successful

@@ -0,0 +1,15 @@

+ summary: Test contains few testcases linking to various glibc libraries. Testing if

+     testcases can be successfuly linked and run

+ description: ''

+ contact:

+ - Sergey Kolosov <skolosov@redhat.com>

+ component:

+ - glibc

+ test: ./runtest.sh

+ framework: beakerlib

+ recommend:

+ - glibc

+ - gcc

+ duration: 30m

+ extra-summary: /tools/glibc/Sanity/basic-linking-sanity

+ extra-task: /tools/glibc/Sanity/basic-linking-sanity

@@ -0,0 +1,58 @@

+ #!/bin/bash

+ # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   runtest.sh of /tools/glibc/Sanity/basic-linking-sanity

+ #   Description: Test contains few testcases linking to various glibc libraries. Testing if testcases can be successfuly linked and run

+ #   Author: Petr Muller <pmuller@redhat.com>

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ #

+ #   Copyright (c) 2009 Red Hat, Inc. All rights reserved.

+ #

+ #   This copyrighted material is made available to anyone wishing

+ #   to use, modify, copy, or redistribute it subject to the terms

+ #   and conditions of the GNU General Public License version 2.

+ #

+ #   This program is distributed in the hope that it will be

+ #   useful, but WITHOUT ANY WARRANTY; without even the implied

+ #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR

+ #   PURPOSE. See the GNU General Public License for more details.

+ #

+ #   You should have received a copy of the GNU General Public

+ #   License along with this program; if not, write to the Free

+ #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,

+ #   Boston, MA 02110-1301, USA.

+ #

+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ 

+ # Include rhts environment

+ . /usr/share/beakerlib/beakerlib.sh || exit 1

+ 

+ PACKAGE="glibc"

+ 

+ rlJournalStart

+   rlPhaseStartTest "Compiling"

+     rlRun "gcc lc.c -lc -o lc -fno-builtin" 0 "Testing for -lc linkage"

+     rlRun "gcc lm.c -lm -o lm -fno-builtin" 0 "Testing for -lm linkage"

+     rlRun "gcc lrt.c -lrt -o lrt -fno-builtin" 0 "Testing for -lrt linkage"

+     rlRun "gcc lpthread.c -lpthread -o lpthread -fno-builtin" 0 "Testing for -lpthread linkage"

+   rlPhaseEnd

+ 

+   rlPhaseStartTest

+     rlRun "./lc" 0 "Running lc testcase"

+     rlRun "./lm" 0 "Running lm testcase"

+     rlRun "./lrt" 0 "Running lrt testcase"

+     rlRun "./lpthread" 0 "Running lpthread testcase"

+ 

+     rlAssertNotDiffer "lc.out" "lc.golden"

+     rlAssertNotDiffer "lm.out" "lm.golden"

+     rlAssertNotDiffer "lrt.out" "lrt.golden"

+     rlAssertNotDiffer "lpthread.out" "lpthread.golden"

+   rlPhaseEnd

+ 

+   rlPhaseStartCleanup

+     rlBundleLogs "outputs" *.out

+     rlRun "rm lc lc.out lm lm.out lrt lrt.out lpthread lpthread.out"

+   rlPhaseEnd

+ rlJournalEnd