<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
#include "store/upk_db.h"
#include "upk_buddy.h"

int DEBUG = 0;

int main( 
    int   argc, 
    char *argv[] 
) {
    char    *file = "./store.sqlite";
    int      rc;
    int      i;
    int      pid;
    char    *event;
    char    *status;
    const char    *cp;
    const char    *command = "../do-sleep";
    struct upk_srvc s = {NULL, "package-1", "service-1" };

    printf("1..5\n");

    rc = upk_db_init( file, &s.pdb );

    if(rc < 0) {
	printf("db_init failed. nnExiting.\n");
	exit(-1);
    }

    cp = upk_db_service_actual_status(  &s, UPK_STATUS_VALUE_STOP );
    upk_test_eq( cp, "stop" );
    cp = upk_db_service_actual_status(  &s, UPK_STATUS_VALUE_START );
    upk_test_eq( cp, "start" );
    upk_db_service_cmdline(&s, command);
    cp = upk_db_service_desired_status(  &s, UPK_STATUS_VALUE_START );
    upk_test_eq( cp, "start" );
    pid = upk_buddy_start( &s, command, NULL);
    upk_test_isnt(pid,-1, "upk_buddy_start returned positive id");
    if( pid < 0 ) {
	printf( "upk_buddy_start failed (%d)\n", pid );
	exit( -1 );
    }

    s.service=strdup("service                 ");
    for (i = 0 ; i < 1024 ; i++) {
      sprintf(s.service,"svc-%d",i);
      pid = upk_buddy_start_async( &s, command, NULL);
    }

    for (;;) {
      cp = upk_db_service_actual_status( &s, 0 );
      if (!strcmp(cp,"start")) { break; }
      sleep(3);
    }
    upk_test_is (upk_buddy_stop( &s ),0, "stopping the buddy returned 0");
    upk_test_eq( cp, "stop");
    s.service="talker";
    upk_db_service_cmdline(&s, "../talker");
    pid = upk_buddy_start( &s, "../talker", NULL);
    upk_buddy_stop( &s );
    wait();
    
    sqlite3_close( s.pdb );
}<commit_msg>o remove 1024 buddy test<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
#include "store/upk_db.h"
#include "upk_buddy.h"

int DEBUG = 0;

int main( 
    int   argc, 
    char *argv[] 
) {
    char    *file = "./store.sqlite";
    int      rc;
    int      i;
    int      pid;
    char    *event;
    char    *status;
    const char    *cp;
    const char    *command = "../do-sleep";
    struct upk_srvc s = {NULL, "package-1", "service-1" };

    printf("1..5\n");

    rc = upk_db_init( file, &s.pdb );

    if(rc < 0) {
	printf("db_init failed. nnExiting.\n");
	exit(-1);
    }

    cp = upk_db_service_actual_status(  &s, UPK_STATUS_VALUE_STOP );
    upk_test_eq( cp, "stop" );
    cp = upk_db_service_actual_status(  &s, UPK_STATUS_VALUE_START );
    upk_test_eq( cp, "start" );
    upk_db_service_cmdline(&s, command);
    cp = upk_db_service_desired_status(  &s, UPK_STATUS_VALUE_START );
    upk_test_eq( cp, "start" );
    pid = upk_buddy_start( &s, command, NULL, NULL);
    upk_test_isnt(pid,-1, "upk_buddy_start returned positive id");
    if( pid < 0 ) {
	printf( "upk_buddy_start failed (%d)\n", pid );
	exit( -1 );
    }

    upk_test_is (upk_buddy_stop( &s ),0, "stopping the buddy returned 0");
    upk_test_eq( cp, "stop");
    s.service="talker";
    upk_db_service_cmdline(&s, "../talker");
    pid = upk_buddy_start( &s, "../talker", NULL, NULL);
    upk_buddy_stop( &s );
    wait();
    
    sqlite3_close( s.pdb );
}
{'fraction_non_alphanumeric': 0.16536848412222888, 'fraction_numerical': 0.011683642899940084, 'mean_word_length': 2.751685393258427, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1588898', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1367, 'n_words': 288}