-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
217 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,8 @@ endif | |
|
||
DIRS += appenv | ||
DIRS += go | ||
DIRS += strace | ||
|
||
|
||
.PHONY: $(DIRS) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
1 | ||
2 | ||
3 | ||
test1.txt | ||
test2.txt | ||
test3.txt | ||
test4.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
TOP=$(abspath ../..) | ||
include $(TOP)/defs.mak | ||
|
||
APPDIR = appdir | ||
CFLAGS = -fPIC | ||
LDFLAGS = -Wl,-rpath=$(MUSL_LIB) | ||
|
||
all: | ||
$(MAKE) myst | ||
$(MAKE) rootfs | ||
|
||
rootfs: strace.c | ||
mkdir -p $(APPDIR)/bin | ||
$(CC) $(CFLAGS) -o $(APPDIR)/bin/strace strace.c $(LDFLAGS) | ||
$(MYST) mkcpio $(APPDIR) rootfs | ||
|
||
OPTS = | ||
|
||
ifdef PERF | ||
OPTS += --perf | ||
endif | ||
|
||
OPTS += --thread-stack-size=1048576 | ||
|
||
tests: all test1 test2 test3 test4 | ||
echo " === passed test strace" | ||
|
||
test1: | ||
-$(MYST_EXEC) rootfs /bin/strace --strace-filter=SYS_invali $(OPTS) 2> test1.txt || $(RUNTEST) diff test1.txt test1.expected.txt | ||
echo "=== test1 passed" | ||
|
||
test2: | ||
-$(MYST_EXEC) rootfs /bin/strace --strace-filter=SYS_mmap --strace-exclude-filter=SYS_ioctl $(OPTS) 2> test2.txt || $(RUNTEST) diff test2.txt test2.expected.txt | ||
echo "=== test2 passed" | ||
|
||
test3: | ||
$(MYST_EXEC) rootfs /bin/strace --strace-filter=SYS_close $(OPTS) 2> test3.txt | ||
cat test3.txt | grep "SYS_" > 1 && cat test3.txt | grep "SYS_close" > 2 && $(RUNTEST) diff 1 2 | ||
echo "=== test3 passed" | ||
|
||
test4: | ||
$(MYST_EXEC) rootfs /bin/strace --strace-exclude-filter=SYS_open $(OPTS) 2> test4.txt | ||
cat test4.txt | grep -v "SYS_open" > 3 && $(RUNTEST) diff 3 test4.txt | ||
echo "=== test4 passed" | ||
|
||
myst: | ||
$(MAKE) -C $(TOP)/tools/myst | ||
|
||
clean: | ||
rm -rf $(APPDIR) rootfs export ramfs 1 2 3 test1.txt text2.txt test3.txt test4.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
#include <assert.h> | ||
#include <limits.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
|
||
void foofoo() | ||
{ | ||
} | ||
|
||
int main(int argc, const char* argv[]) | ||
{ | ||
char buf[PATH_MAX]; | ||
|
||
foofoo(); | ||
|
||
getcwd(buf, sizeof(buf)); | ||
assert(strcmp(buf, "/") == 0); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Unknown syscall SYS_invali specified in --strace-filter or --strace-exclude-filter | ||
Aborted (core dumped) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Cannot specify both --strace-filter and --strace-exclude-filter | ||
Aborted (core dumped) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters