Skip to content

Commit

Permalink
Adjust tests to use 10 parameters
Browse files Browse the repository at this point in the history
This should catch problems in the ppc64le port.

Signed-off-by: gbelinassi <[email protected]>
  • Loading branch information
giulianobelinassi committed Jan 30, 2025
1 parent 5bd0010 commit 3b57143
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 40 deletions.
2 changes: 1 addition & 1 deletion tests/chroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ main(void)
printf("Reached the end of file; quitting.\n");
return 0;
}
int_params(1, 2, 3, 4, 5, 6, 7, 8);
int_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
float_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/chroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libparameters_livepatch1.so')

child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

Expand Down
4 changes: 2 additions & 2 deletions tests/libmanyprocesses.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
* reviewed and extended accordingly.
*/
void
int_params(int a, int b, int c, int d, int e, int f, int g, int h)
int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", a, b, c, d, e, f, g, h);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", a, b, c, d, e, f, g, h, i, j);
}

/*
Expand Down
4 changes: 2 additions & 2 deletions tests/libmanyprocesses_livepatch1.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <stdio.h>

void
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h)
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", h, g, f, e, d, c, b, a);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", j, i, h, g, f, e, d, c, b, a);
}

void
Expand Down
4 changes: 2 additions & 2 deletions tests/libparameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
* reviewed and extended accordingly.
*/
void
int_params(int a, int b, int c, int d, int e, int f, int g, int h)
int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", a, b, c, d, e, f, g, h);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", a, b, c, d, e, f, g, h, i, j);
}

/*
Expand Down
3 changes: 2 additions & 1 deletion tests/libparameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
* along with libpulp. If not, see <http://www.gnu.org/licenses/>.
*/

void int_params(int a, int b, int c, int d, int e, int f, int g, int h);
void int_params(int a, int b, int c, int d, int e, int f, int g, int h,
int i, int j);

void float_params(float a, float b, float c, float d, float e, float f,
float g, float h, float i, float j);
4 changes: 2 additions & 2 deletions tests/libparameters_livepatch1.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <stdio.h>

void
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h)
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", h, g, f, e, d, c, b, a);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", j, i, h, g, f, e, d, c, b, a);
}

void
Expand Down
4 changes: 2 additions & 2 deletions tests/libparameters_livepatch3.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <stdio.h>

void
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h)
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", h, g, f, e, d, c, b, a);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", j, i, h, g, f, e, d, c, b, a);
}

void
Expand Down
4 changes: 2 additions & 2 deletions tests/libprocess_livepatch1.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include <stdio.h>

void
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h)
new_int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", h, g, f, e, d, c, b, a);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", j, i, h, g, f, e, d, c, b, a);
}

void
Expand Down
2 changes: 1 addition & 1 deletion tests/libpulp_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

try:
Expand Down
5 changes: 3 additions & 2 deletions tests/manyprocesses.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
#include <errno.h>
#include <stdio.h>

void int_params(int a, int b, int c, int d, int e, int f, int g, int h);
void int_params(int a, int b, int c, int d, int e, int f, int g, int h,
int i, int j);

void float_params(float a, float b, float c, float d, float e, float f,
float g, float h, float i, float j);
Expand All @@ -43,7 +44,7 @@ main(void)
printf("Reached the end of file; quitting.\n");
return 0;
}
int_params(1, 2, 3, 4, 5, 6, 7, 8);
int_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
float_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/manyprocesses.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@

for child in childs:
child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

testsuite.childless_livepatch(wildcard=None, verbose=True, revert_lib='libmanyprocesses.so.0')

for child in childs:
child.sendline('')
child.expect('1-2-3-4-5-6-7-8', reject='8-7-6-5-4-3-2-1');
child.expect('1-2-3-4-5-6-7-8-9-10', reject='10-9-8-7-6-5-4-3-2-1');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0',
reject='10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0');

Expand Down
6 changes: 3 additions & 3 deletions tests/mprotect_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libparameters_livepatch1.so')

child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libparameters_livepatch1.so', revert=True)

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0',
reject='10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0');

Expand Down
4 changes: 2 additions & 2 deletions tests/nolibpulp.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

out = child.livepatch('.libs/libparameters_livepatch1.so', capture_tool_output=True)
if out.find("Libpulp not found in target process") == -1:
errorcode = 1

child.sendline('')
child.expect('1-2-3-4-5-6-7-8', reject='8-7-6-5-4-3-2-1');
child.expect('1-2-3-4-5-6-7-8-9-10', reject='10-9-8-7-6-5-4-3-2-1');

child.close(force=True)
exit(errorcode)
2 changes: 1 addition & 1 deletion tests/parameters.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ main(void)
printf("Reached the end of file; quitting.\n");
return 0;
}
int_params(1, 2, 3, 4, 5, 6, 7, 8);
int_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
float_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libparameters_livepatch1.so')

child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

Expand Down
6 changes: 3 additions & 3 deletions tests/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#include <stdio.h>

__attribute__((noinline)) void
int_params(int a, int b, int c, int d, int e, int f, int g, int h)
int_params(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j)
{
printf("%d-%d-%d-%d-%d-%d-%d-%d\n", a, b, c, d, e, f, g, h);
printf("%d-%d-%d-%d-%d-%d-%d-%d-%d-%d\n", a, b, c, d, e, f, g, h, i, j);
}

__attribute__((noinline)) void
Expand All @@ -52,7 +52,7 @@ main(void)
printf("Reached the end of file; quitting.\n");
return 0;
}
int_params(1, 2, 3, 4, 5, 6, 7, 8);
int_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
float_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libprocess_livepatch1.so')

child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

Expand Down
6 changes: 3 additions & 3 deletions tests/process_revert.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libprocess_livepatch1.so')

child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libprocess_livepatch1.so', revert=True)

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.close(force=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/relative_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
child.expect('Waiting for input.')

child.sendline('')
child.expect('1-2-3-4-5-6-7-8');
child.expect('1-2-3-4-5-6-7-8-9-10');
child.expect('1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

child.livepatch('.libs/libparameters_livepatch3.so')

child.sendline('')
child.expect('8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8');
child.expect('10-9-8-7-6-5-4-3-2-1', reject='1-2-3-4-5-6-7-8-9-10');
child.expect('10.0-9.0-8.0-7.0-6.0-5.0-4.0-3.0-2.0-1.0',
reject='1.0-2.0-3.0-4.0-5.0-6.0-7.0-8.0-9.0-10.0');

Expand Down
2 changes: 1 addition & 1 deletion tests/syscall_restart.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ main(void)
return 1; /* The test driver is not expected to send EOF. */
}

int_params(1, 2, 3, 4, 5, 6, 7, 8);
int_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
float_params(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
return 0; /* At least one byte was read. */
}

0 comments on commit 3b57143

Please sign in to comment.