From ba0e668d8b2f86dc2dc8af035364cf5cd729a658 Mon Sep 17 00:00:00 2001
From: jce <jce@unknown>
Date: Thu, 13 Jun 2002 19:06:53 +0000
Subject: [PATCH] modified for new api

---
 .../slurm_unit/api/manual/allocate-tst.c      | 62 ++++++++++++++-----
 .../slurm_unit/api/manual/job_info-tst.c      |  2 +-
 .../slurm_unit/api/manual/node_info-tst.c     |  2 +-
 .../api/manual/partition_info-tst.c           |  2 +-
 testsuite/slurm_unit/api/manual/submit-tst.c  | 34 +++++++---
 5 files changed, 73 insertions(+), 29 deletions(-)

diff --git a/testsuite/slurm_unit/api/manual/allocate-tst.c b/testsuite/slurm_unit/api/manual/allocate-tst.c
index 0616073cd29..4cab1570479 100644
--- a/testsuite/slurm_unit/api/manual/allocate-tst.c
+++ b/testsuite/slurm_unit/api/manual/allocate-tst.c
@@ -10,44 +10,72 @@ int
 main (int argc, char *argv[])
 {
 	int error_code;
-	char *node_list;
-	uint32_t job_id;
 
-	error_code = slurm_allocate_resources
-		("User=1500 JobName=job01 TotalNodes=400 TotalProcs=1000 ReqNodes=lx[3000-3003] Partition=batch MinRealMemory=1024 MinTmpDisk=2034 Groups=students,employee MinProcs=4 Contiguous=YES Key=1234 Immediate",
-		 &node_list, &job_id);
+    job_desc_msg_t job_mesg;
+
+	slurm_init_job_desc_msg( &job_mesg );
+    job_mesg. contiguous = 1;
+    job_mesg. features = "bigDisk\0";
+    job_mesg. groups = ("students,employee\0");
+    job_mesg. job_id = 12345;
+    job_mesg. name = ("job01\0");
+    job_mesg. partition_key = NULL;
+    job_mesg. min_procs = 4;
+    job_mesg. min_memory = 1024;
+    job_mesg. min_tmp_disk = 2034;
+    job_mesg. partition = "batch\0";
+    job_mesg. priority = 100;
+    job_mesg. req_nodes = "lx[3000-3003]\0";
+    job_mesg. job_script = "/bin/hostname\0";
+    job_mesg. shared = 0;
+    job_mesg. time_limit = 100;
+    job_mesg. num_procs = 1000;
+    job_mesg. num_nodes = 400;
+    job_mesg. user_id = 1500;
+
+
+	error_code = slurm_allocate_resources ( &job_mesg ); 
 	if (error_code)
 		printf ("allocate error %d\n", error_code);
 	else {
-		printf ("allocate nodes %s to job %u\n", node_list, job_id);
-		free (node_list);
+		printf ("allocate nodes %s to job %u\n", job_mesg.req_nodes, job_mesg.job_id);
 	}
 
+
 	while (1) {
-		error_code = slurm_allocate_resources
-			("User=1500 JobName=more TotalProcs=4000 Partition=batch Key=1234 Immediate",
-			 &node_list, &job_id);
+		/* the string also had Immediate */
+		slurm_init_job_desc_msg( &job_mesg );
+		job_mesg. name = ("more\0");
+		job_mesg. partition_key = "1234";
+		job_mesg. partition = "batch\0";
+		job_mesg. num_procs = 4000;
+		job_mesg. user_id = 1500;
+
+		error_code = slurm_allocate_resources( &job_mesg );
 		if (error_code) {
 			printf ("allocate error %d\n", error_code);
 			break;
 		}
 		else {
-			printf ("allocate nodes %s to job %u\n", node_list, job_id);
-			free (node_list);
+			printf ("allocate nodes %s to job %u\n", job_mesg.req_nodes, job_mesg.job_id);
 		}
 	}
 
 	while (1) {
-		error_code = slurm_allocate_resources
-			("User=1500 JobName=more TotalProcs=40 Partition=batch Key=1234 Immediate",
-			 &node_list, &job_id);
+		slurm_init_job_desc_msg( &job_mesg );
+		job_mesg. name = ("more\0");
+		job_mesg. partition_key = "1234";
+		job_mesg. partition = "batch\0";
+		job_mesg. num_procs = 40;
+		job_mesg. user_id = 1500;
+
+		error_code = slurm_allocate_resources( &job_mesg );
 		if (error_code) {
 			printf ("allocate error %d\n", error_code);
 			break;
 		}
 		else {
-			printf ("allocate nodes %s to job %u\n", node_list, job_id);
-			free (node_list);
+			printf ("allocate nodes %s to job %u\n", job_mesg.req_nodes, job_mesg.job_id);
 		}
 	}
 
diff --git a/testsuite/slurm_unit/api/manual/job_info-tst.c b/testsuite/slurm_unit/api/manual/job_info-tst.c
index 3dd3ddf4548..f19999c50f7 100644
--- a/testsuite/slurm_unit/api/manual/job_info-tst.c
+++ b/testsuite/slurm_unit/api/manual/job_info-tst.c
@@ -20,7 +20,7 @@ main (int argc, char *argv[])
 		return (error_code);
 	}
 
-	slurm_print_job_info_msg ( job_info_msg_ptr ) ;
+	slurm_print_job_info_msg ( stdout, job_info_msg_ptr ) ;
 
 	slurm_free_job_info ( job_info_msg_ptr ) ;
 	return (0);
diff --git a/testsuite/slurm_unit/api/manual/node_info-tst.c b/testsuite/slurm_unit/api/manual/node_info-tst.c
index ccdc5e6f051..93546ee7867 100644
--- a/testsuite/slurm_unit/api/manual/node_info-tst.c
+++ b/testsuite/slurm_unit/api/manual/node_info-tst.c
@@ -30,7 +30,7 @@ main (int argc, char *argv[])
 		 * last 1 entry, and every 200th entry */
 		if ((i < 10) || (i % 200 == 0) || 
 		    ((i + 1)  == node_info_msg_ptr-> record_count)) {
-			slurm_print_node_table ( & node_ptr[i] ) ;
+			slurm_print_node_table ( stdout, & node_ptr[i] ) ;
 		}
 		else if ((i==10) || (i % 200 == 1))
 			printf ("skipping...\n");
diff --git a/testsuite/slurm_unit/api/manual/partition_info-tst.c b/testsuite/slurm_unit/api/manual/partition_info-tst.c
index 35c12cb455a..34448da70ba 100644
--- a/testsuite/slurm_unit/api/manual/partition_info-tst.c
+++ b/testsuite/slurm_unit/api/manual/partition_info-tst.c
@@ -23,7 +23,7 @@ main (int argc, char *argv[])
 	note("Updated at %lx, record count %d\n",
 		(time_t) part_info_ptr->last_update, part_info_ptr->record_count);
 
-	slurm_print_partition_info ( part_info_ptr );
+	slurm_print_partition_info ( stdout, part_info_ptr );
 	slurm_free_partition_info (part_info_ptr);
 	return (0);
 }
diff --git a/testsuite/slurm_unit/api/manual/submit-tst.c b/testsuite/slurm_unit/api/manual/submit-tst.c
index f92acebae1b..0404e26f0e6 100644
--- a/testsuite/slurm_unit/api/manual/submit-tst.c
+++ b/testsuite/slurm_unit/api/manual/submit-tst.c
@@ -11,17 +11,34 @@ int
 main (int argc, char *argv[]) 
 {
 	int error_code, i, count;
-	uint32_t job_id;
+	job_desc_msg_t job_mesg;
+	
+	job_mesg. contiguous = 1; 
+	job_mesg. features = "bigDisk\0";
+	job_mesg. groups = ("students,employee\0");
+	job_mesg. job_id = 12345;
+	job_mesg. name = ("job01\0");
+	job_mesg. partition_key = NULL;
+	job_mesg. min_procs = 4;
+	job_mesg. min_memory = 1024;
+	job_mesg. min_tmp_disk = 2034;
+	job_mesg. partition = "batch\0";
+	job_mesg. priority = 100;
+	job_mesg. req_nodes = "lx[3000-3003]\0";
+	job_mesg. job_script = "/bin/hostname\0";
+	job_mesg. shared = 0;
+	job_mesg. time_limit = 100;
+	job_mesg. num_procs = 1000;
+	job_mesg. num_nodes = 400;
+	job_mesg. user_id = 1500;
 
-	error_code = slurm_submit_batch_job
-		("User=1500 Script=/bin/hostname JobName=job01 TotalNodes=400 TotalProcs=1000 ReqNodes=lx[3000-3003] Partition=batch MinRealMemory=1024 MinTmpDisk=2034 Groups=students,employee MinProcs=4 Contiguous=YES Key=1234",
-		 &job_id);
+	error_code = slurm_submit_batch_job( &job_mesg );
 	if (error_code) {
 		printf ("submit error %d\n", error_code);
 		return (error_code);
 	}
 	else
-		printf ("job %u submitted\n", job_id);
+		printf ("job %u submitted\n", job_mesg.job_id);
 
 	if (argc > 1) 
 		count = atoi (argv[1]);
@@ -29,15 +46,14 @@ main (int argc, char *argv[])
 		count = 5;
 
 	for (i=0; i<count; i++) {
-		error_code = slurm_submit_batch_job
-			("User=1500 Script=/bin/hostname JobName=more TotalProcs=4000 Partition=batch Key=1234 ",
-			 &job_id);
+		job_mesg.job_id = job_mesg.job_id + i;
+		error_code = slurm_submit_batch_job( &job_mesg);
 		if (error_code) {
 			printf ("submit error %d\n", error_code);
 			break;
 		}
 		else {
-			printf ("job %u submitted\n", job_id);
+			printf ("job %u submitted\n", job_mesg.job_id);
 		}
 	}
 
-- 
GitLab