mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
zdtm/static: test the offset migration of ELF files
Signed-off-by: Michal Clapinski <mclapinski@google.com>
This commit is contained in:
parent
29026496d4
commit
41938f14b6
2 changed files with 43 additions and 0 deletions
|
|
@ -269,6 +269,7 @@ TST_NOFILE := \
|
|||
sigtrap \
|
||||
sigtrap01 \
|
||||
change_mnt_context \
|
||||
fd_offset \
|
||||
# jobctl00 \
|
||||
|
||||
PKG_CONFIG ?= pkg-config
|
||||
|
|
|
|||
42
test/zdtm/static/fd_offset.c
Normal file
42
test/zdtm/static/fd_offset.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#include <fcntl.h>
|
||||
|
||||
#include "zdtmtst.h"
|
||||
#include "lock.h"
|
||||
|
||||
const char *test_doc = "Check that criu properly restores offsets on ELF files";
|
||||
const char *test_author = "Michal Clapinski <mclapinski@google.com>";
|
||||
|
||||
void check_offset(int fd)
|
||||
{
|
||||
int offset = lseek(fd, 0, SEEK_CUR);
|
||||
if (offset < 0) {
|
||||
fail("lseek");
|
||||
exit(1);
|
||||
}
|
||||
if (offset != 0) {
|
||||
fail("wrong offset; expected: 0, got: %d", offset);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
|
||||
test_init(argc, argv);
|
||||
|
||||
fd = open("/proc/self/exe", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
fail("open");
|
||||
exit(1);
|
||||
}
|
||||
check_offset(fd);
|
||||
|
||||
test_daemon();
|
||||
test_waitsig();
|
||||
|
||||
check_offset(fd);
|
||||
|
||||
pass();
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue