Skip to content

Commit e5c708b

Browse files
committed
testenv: Update README and link it from top-level
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
1 parent 645dbf8 commit e5c708b

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

README.org

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ Before you can start completing step in this tutorial, you will need to
5252
install a few dependencies on your system. These are are described in
5353
[[file:setup_dependencies.org]].
5454

55+
We also provide a helper script that will set up a test environment with
56+
virtual interfaces for you to test your code on. This is introduced in the
57+
basic lessons, and also has [[file:testenv/README.org][it's own README file]].
58+
5559
* How the lessons are organised
5660
The tutorial is organised into a number of lessons; each lesson has its own
5761
subdirectory, and the lessons are grouped by category:

testenv/README.org

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,39 @@
22
#+TITLE: Test environment script
33
#+OPTIONS: ^:nil
44

5-
This directory contains a test environment setup script that you can use to
6-
create test environments for testing your XDP programs. It works by creating
7-
virtual ethernet (veth) interface pairs and moving one end of each pair to
8-
another namespace. You can load the XDP program in the other namespace and
5+
This directory contains a setup script that you can use to create test
6+
environments for testing your XDP programs. It works by creating virtual
7+
ethernet (veth) interface pairs and moving one end of each pair to another
8+
network namespace. You can load the XDP program in the other namespace and
99
send traffic to it through the interface that is visible in the root
1010
namespace.
1111

12+
Run =./testenv.sh= with no parameter to get a list of available commands, or
13+
run =./testenv.sh --help= to get the full help listing with all options. The
14+
script can maintain several environments active at the same time, and you
15+
can switch between them using the =--name= option.
16+
17+
If you don't specify a name, the most recently used environment will be
18+
used. If you don't specify a name when setting up a new environment, a
19+
random name will be generated for you.
20+
1221
Examples:
1322

1423
Setup new environment named "test":
15-
=./testenv.sh create test=
24+
=./testenv.sh setup --name=test=
25+
26+
Create a shell alias for easy use of script from anywhere:
27+
=eval $(./testenv.sh alias)=
28+
29+
See the currently active environment, and a list of all active environment
30+
names (with alias defined as above):
31+
=t status=
1632

17-
Enter the environment:
18-
=./testenv.sh enter test=
33+
Enter the currently active environment:
34+
=t enter=
1935

2036
Execute a command inside the environment:
21-
=./testenv ns_exec test ip a=
37+
=t exec -- ip a=
2238

2339
Teardown the environment:
24-
=./testenv teardown test=
40+
=t teardown=

0 commit comments

Comments
 (0)