Browse Source

update ltp scripts

tianshuliang 2 years ago
parent
commit
7c5e5c007f
100 changed files with 5530 additions and 1441 deletions
  1. 2 2
      ltp/runtest/can
  2. 1 1
      ltp/runtest/connectors
  3. 0 1
      ltp/runtest/controllers
  4. 0 1
      ltp/runtest/cve
  5. 1 1
      ltp/runtest/fs
  6. 1 1
      ltp/runtest/fs_readonly
  7. 0 1
      ltp/runtest/ima
  8. 0 1
      ltp/runtest/kernel_misc
  9. 1 1
      ltp/runtest/meta-oe.gnome.extended
  10. 5 4
      ltp/runtest/meta-oe.gnome.gimp
  11. 69 60
      ltp/runtest/meta-oe.gnome.gnome
  12. 13 11
      ltp/runtest/meta-oe.gnome.support
  13. 8 3
      ltp/runtest/meta-oe.multimedia.connectivity
  14. 62 47
      ltp/runtest/meta-oe.multimedia.multimedia
  15. 5 5
      ltp/runtest/meta-oe.multimedia.support
  16. 1 7
      ltp/runtest/mm
  17. 0 5
      ltp/runtest/net.features
  18. 24 24
      ltp/runtest/net_stress.multicast
  19. 4 2
      ltp/runtest/net_stress.route
  20. 23 5
      ltp/runtest/oe-core.core
  21. 0 1
      ltp/runtest/oe-core.graphics
  22. 7 1
      ltp/runtest/oe-core.multimedia
  23. 3 1
      ltp/runtest/oe-core.sato
  24. 17 8
      ltp/runtest/oe-core.support
  25. 1 0
      ltp/runtest/start_test
  26. 10 33
      ltp/runtest/syscalls
  27. 0 2
      ltp/runtest/syscalls-ipc
  28. 43 4
      ltp/scenario_groups/default
  29. 2 2
      ltp/testcases/bin/bbr01.sh
  30. 2 2
      ltp/testcases/bin/bbr02.sh
  31. 8 2
      ltp/testcases/bin/busy_poll01.sh
  32. 8 2
      ltp/testcases/bin/busy_poll02.sh
  33. 8 2
      ltp/testcases/bin/busy_poll03.sh
  34. 106 0
      ltp/testcases/bin/can_run_tests.sh
  35. 3 3
      ltp/testcases/bin/cmdlib.sh
  36. 9 0
      ltp/testcases/bin/connector_test.sh
  37. 1 17
      ltp/testcases/bin/cpio_tests.sh
  38. 5 36
      ltp/testcases/bin/cpuset_funcs.sh
  39. 5 0
      ltp/testcases/bin/cpuset_inherit_testset.sh
  40. 14 3
      ltp/testcases/bin/dccp01.sh
  41. 2 2
      ltp/testcases/bin/df01.sh
  42. 1 1
      ltp/testcases/bin/dnsmasq_tests.sh
  43. 79 25
      ltp/testcases/bin/host01.sh
  44. 1 1
      ltp/testcases/bin/icmp-uni-basic.sh
  45. 1 1
      ltp/testcases/bin/icmp-uni-vti.sh
  46. 24 60
      ltp/testcases/bin/if-mtu-change.sh
  47. 4 20
      ltp/testcases/bin/ima_keys.sh
  48. 56 6
      ltp/testcases/bin/ima_measurements.sh
  49. 4 125
      ltp/testcases/bin/ima_setup.sh
  50. 57 249
      ltp/testcases/bin/ima_tpm.sh
  51. 4 5
      ltp/testcases/bin/ip_tests.sh
  52. 1 1
      ltp/testcases/bin/ipsec_lib.sh
  53. 1 3
      ltp/testcases/bin/lsmod01.sh
  54. 41 0
      ltp/testcases/bin/mcast-group-multiple-socket
  55. 35 0
      ltp/testcases/bin/mcast-group-same-group
  56. 35 0
      ltp/testcases/bin/mcast-group-single-socket
  57. 35 0
      ltp/testcases/bin/mcast-group-source-filter
  58. 5 29
      ltp/testcases/bin/mcast-lib.sh
  59. 207 0
      ltp/testcases/bin/mcast4-pktfld01
  60. 225 0
      ltp/testcases/bin/mcast4-pktfld02
  61. 199 0
      ltp/testcases/bin/mcast4-queryfld01
  62. 202 0
      ltp/testcases/bin/mcast4-queryfld02
  63. 208 0
      ltp/testcases/bin/mcast4-queryfld03
  64. 202 0
      ltp/testcases/bin/mcast4-queryfld04
  65. 213 0
      ltp/testcases/bin/mcast4-queryfld05
  66. 219 0
      ltp/testcases/bin/mcast4-queryfld06
  67. 203 0
      ltp/testcases/bin/mcast6-pktfld01
  68. 220 0
      ltp/testcases/bin/mcast6-pktfld02
  69. 197 0
      ltp/testcases/bin/mcast6-queryfld01
  70. 199 0
      ltp/testcases/bin/mcast6-queryfld02
  71. 205 0
      ltp/testcases/bin/mcast6-queryfld03
  72. 199 0
      ltp/testcases/bin/mcast6-queryfld04
  73. 209 0
      ltp/testcases/bin/mcast6-queryfld05
  74. 213 0
      ltp/testcases/bin/mcast6-queryfld06
  75. 49 30
      ltp/testcases/bin/memcg_failcnt.sh
  76. 42 22
      ltp/testcases/bin/memcg_force_empty.sh
  77. 382 182
      ltp/testcases/bin/memcg_lib.sh
  78. 59 47
      ltp/testcases/bin/memcg_limit_in_bytes.sh
  79. 57 55
      ltp/testcases/bin/memcg_max_usage_in_bytes_test.sh
  80. 60 26
      ltp/testcases/bin/memcg_memsw_limit_in_bytes_test.sh
  81. 41 61
      ltp/testcases/bin/memcg_move_charge_at_immigrate_test.sh
  82. 43 25
      ltp/testcases/bin/memcg_stat_rss.sh
  83. 77 51
      ltp/testcases/bin/memcg_stat_test.sh
  84. 34 47
      ltp/testcases/bin/memcg_subgroup_charge.sh
  85. 45 22
      ltp/testcases/bin/memcg_usage_in_bytes_test.sh
  86. 38 22
      ltp/testcases/bin/memcg_use_hierarchy_test.sh
  87. 15 5
      ltp/testcases/bin/meta-oe/gnome/connectivity/libnma.sh
  88. 11 2
      ltp/testcases/bin/meta-oe/gnome/connectivity/network-manager-applet.sh
  89. 13 4
      ltp/testcases/bin/meta-oe/gnome/extended/gparted.sh
  90. 13 4
      ltp/testcases/bin/meta-oe/gnome/gimp/babl.sh
  91. 13 6
      ltp/testcases/bin/meta-oe/gnome/gimp/gegl.sh
  92. 36 0
      ltp/testcases/bin/meta-oe/gnome/gimp/gimp.sh
  93. 42 0
      ltp/testcases/bin/meta-oe/gnome/gimp/libmypaint.sh
  94. 42 0
      ltp/testcases/bin/meta-oe/gnome/gimp/mypaint-brushes-1.0.sh
  95. 42 0
      ltp/testcases/bin/meta-oe/gnome/gnome/amtk.sh
  96. 42 0
      ltp/testcases/bin/meta-oe/gnome/gnome/dconf-editor.sh
  97. 42 0
      ltp/testcases/bin/meta-oe/gnome/gnome/dconf.sh
  98. 42 0
      ltp/testcases/bin/meta-oe/gnome/gnome/devilspie2.sh
  99. 36 0
      ltp/testcases/bin/meta-oe/gnome/gnome/evince.sh
  100. 36 0
      ltp/testcases/bin/meta-oe/gnome/gnome/evolution-data-server-native.sh

+ 2 - 2
ltp/runtest/can

@@ -1,2 +1,2 @@
-can_filter can_filter
-can_rcv_own_msgs can_rcv_own_msgs
+can_filter can_run_tests.sh can_filter
+can_rcv_own_msgs can_run_tests.sh can_rcv_own_msgs

+ 1 - 1
ltp/runtest/connectors

@@ -1,2 +1,2 @@
 #DESCRIPTION:Netlink Connector tests
-cn_pec_sh cn_pec.sh
+Connectors connector_test.sh

+ 0 - 1
ltp/runtest/controllers

@@ -13,7 +13,6 @@ memcg_memsw_limit_in_bytes	memcg_memsw_limit_in_bytes_test.sh
 memcg_stat	memcg_stat_test.sh
 memcg_use_hierarchy	memcg_use_hierarchy_test.sh
 memcg_usage_in_bytes	memcg_usage_in_bytes_test.sh
-memcg_stress		memcg_stress_test.sh
 memcg_control		memcg_control_test.sh
 
 cgroup_fj_function_debug cgroup_fj_function.sh debug

+ 0 - 1
ltp/runtest/cve

@@ -60,4 +60,3 @@ cve-2019-8912 af_alg07
 cve-2020-11494 pty04
 cve-2020-14386 sendto03
 cve-2020-14416 pty03
-cve-2020-29373 io_uring02

+ 1 - 1
ltp/runtest/fs

@@ -58,7 +58,7 @@ ftest06 ftest06
 ftest07 ftest07
 ftest08 ftest08
 
-lftest01	lftest
+lftest01	lftest 100
 writetest01	writetest
 
 #Also run the fs_di (Data Integrity tests)

+ 1 - 1
ltp/runtest/fs_readonly

@@ -51,5 +51,5 @@ test_robind50 test_robind.sh -c "ftest05"
 test_robind51 test_robind.sh -c "ftest06"
 test_robind52 test_robind.sh -c "ftest07"
 test_robind53 test_robind.sh -c "ftest08"
-test_robind54 test_robind.sh -c "-- lftest -n 80"
+test_robind54 test_robind.sh -c "lftest 80"
 test_robind55 test_robind.sh -c "writetest"

+ 0 - 1
ltp/runtest/ima

@@ -5,5 +5,4 @@ ima_tpm ima_tpm.sh
 ima_violations ima_violations.sh
 ima_keys ima_keys.sh
 ima_kexec ima_kexec.sh
-ima_selinux ima_selinux.sh
 evm_overlay evm_overlay.sh

+ 0 - 1
ltp/runtest/kernel_misc

@@ -1,7 +1,6 @@
 kmsg01 kmsg01
 fw_load fw_load
 rtc01 rtc01
-rtc02 rtc02
 block_dev block_dev
 tpci tpci
 tbio tbio

+ 1 - 1
ltp/runtest/meta-oe.gnome.extended

@@ -1,2 +1,2 @@
 	.sh
-gparted	gparted.sh
+gparted	meta-oe/gnome/extended/gparted.sh

+ 5 - 4
ltp/runtest/meta-oe.gnome.gimp

@@ -1,5 +1,6 @@
 	.sh
-babl	babl.sh
-gegl	gegl.sh
-gimp	gimp.sh
-mypaint	mypaint.sh
+babl	meta-oe/gnome/gimp/babl.sh
+gegl	meta-oe/gnome/gimp/gegl.sh
+gimp	meta-oe/gnome/gimp/gimp.sh
+libmypaint	meta-oe/gnome/gimp/libmypaint.sh
+mypaint-brushes-1.0 meta-oe/gnome/gimp/mypaint-brushes-1.0.sh

+ 69 - 60
ltp/runtest/meta-oe.gnome.gnome

@@ -1,61 +1,70 @@
 	.sh
-amtk	amtk.sh
-dconf	dconf.sh
-devilspie	devilspie.sh
-evince	evince.sh
-evolution-data-server	evolution-data-server.sh
-faenza-icon-theme	faenza-icon-theme.sh
-file-roller	file-roller.sh
-gdm	gdm.sh
-gedit	gedit.sh
-geocode-glib	geocode-glib.sh
-gexiv2	gexiv2.sh
-gfbgraph	gfbgraph.sh
-ghex	ghex.sh
-gjs	gjs.sh
-gnome-autoar	gnome-autoar.sh
-gnome-backgrounds	gnome-backgrounds.sh
-gnome-bluetooth	gnome-bluetooth.sh
-gnome-calculator	gnome-calculator.sh
-gnome-calendar	gnome-calendar.sh
-gnome-control-center	gnome-control-center.sh
-gnome-desktop	gnome-desktop.sh
-gnome-disk-utility	gnome-disk-utility.sh
-gnome-flashback	gnome-flashback.sh
-gnome-font-viewer	gnome-font-viewer.sh
-gnome-keyring	gnome-keyring.sh
-gnome-menus	gnome-menus.sh
-gnome-online-accounts	gnome-online-accounts.sh
-gnome-panel	gnome-panel.sh
-gnome-photos	gnome-photos.sh
-gnome-session	gnome-session.sh
-gnome-settings-daemon	gnome-settings-daemon.sh
-gnome-shell	gnome-shell.sh
-gnome-system-monitor	gnome-system-monitor.sh
-gnome-terminal	gnome-terminal.sh
-gnome-tweaks	gnome-tweaks.sh
-graphene	graphene.sh
-grilo	grilo.sh
-gsound	gsound.sh
-gspell	gspell.sh
-gtksourceview	gtksourceview.sh
-gvfs	gvfs.sh
-images	images.sh
-libchamplain	libchamplain.sh
-libgdata	libgdata.sh
-libgsf	libgsf.sh
-libgtkstylus	libgtkstylus.sh
-libgtop	libgtop.sh
-libgweather	libgweather.sh
-libtimezonemap	libtimezonemap.sh
-libwnck	libwnck.sh
-libxklavier	libxklavier.sh
-metacity	metacity.sh
-mutter	mutter.sh
-nautilus	nautilus.sh
-rest	rest.sh
-sysprof	sysprof.sh
-tepl	tepl.sh
-tracker	tracker.sh
-yelp	yelp.sh
-zenity	zenity.sh
+amtk	meta-oe/gnome/gnome/amtk.sh
+dconf	meta-oe/gnome/gnome/dconf.sh
+dconf-editor meta-oe/gnome/gnome/dconf-editor.sh
+devilspie	meta-oe/gnome/gnome/devilspie.sh
+evince	meta-oe/gnome/gnome/evince.sh
+evolution-data-server	meta-oe/gnome/gnome/evolution-data-server.sh
+evolution-data-server-native meta-oe/gnome/gnome/evolution-data-server-native.sh
+faenza-icon-theme	meta-oe/gnome/gnome/evolution-data-server-native.sh
+faenza-icon-theme   meta-oe/gnome/gnome/faenza-icon-theme.sh
+file-roller	meta-oe/gnome/gnome/file-roller.sh
+gdm	meta-oe/gnome/gnome/gdm.sh
+gedit	meta-oe/gnome/gnome/gedit.sh
+geocode-glib	meta-oe/gnome/gnome/geocode-glib.sh
+gexiv2	meta-oe/gnome/gnome/gexiv2.sh
+gfbgraph	meta-oe/gnome/gnome/gfbgraph.sh
+ghex	meta-oe/gnome/gnome/ghex.sh
+gjs	meta-oe/gnome/gnome/gjs.sh
+gnome-autoar	meta-oe/gnome/gnome/gnome-autoar.sh
+gnome-backgrounds	meta-oe/gnome/gnome/gnome-backgrounds.sh
+gnome-bluetooth	meta-oe/gnome/gnome/gnome-bluetooth.sh
+gnome-calculator	meta-oe/gnome/gnome/gnome-calculator.sh
+gnome-calendar	meta-oe/gnome/gnome/gnome-calendar.sh
+gnome-control-center	meta-oe/gnome/gnome/gnome-control-center.sh
+gnome-desktop	meta-oe/gnome/gnome/gnome-desktop3.sh
+gnome-disk-utility	meta-oe/gnome/gnome/gnome-disk-utility.sh
+gnome-flashback	meta-oe/gnome/gnome/gnome-flashback.sh
+gnome-font-viewer	meta-oe/gnome/gnome/gnome-font-viewer.sh
+gnome-keyring	meta-oe/gnome/gnome/gnome-keyring.sh
+gnome-menus	meta-oe/gnome/gnome/gnome-menus3.sh
+gnome-online-accounts	meta-oe/gnome/gnome/gnome-online-accounts.sh
+gnome-panel	meta-oe/gnome/gnome/gnome-panel.sh
+gnome-photos	meta-oe/gnome/gnome/gnome-photos.sh
+gnome-session	meta-oe/gnome/gnome/gnome-session.sh
+gnome-settings-daemon	meta-oe/gnome/gnome/gnome-settings-daemon.sh
+gnome-shell	meta-oe/gnome/gnome/gnome-shell.sh
+gnome-shell-extensions meta-oe/gnome/gnome/gnome-shell-extensions.sh
+gnome-system-monitor	meta-oe/gnome/gnome/gnome-system-monitor.sh
+gnome-terminal	meta-oe/gnome/gnome/gnome-terminal.sh
+gnome-tweaks	meta-oe/gnome/gnome/gnome-tweaks.sh
+graphene	meta-oe/gnome/gnome/graphene.sh
+grilo	meta-oe/gnome/gnome/grilo.sh
+gsound	meta-oe/gnome/gnome/gsound.sh
+gspell	meta-oe/gnome/gnome/gspell.sh
+gtksourceview	meta-oe/gnome/gnome/gtksourceview3.sh
+gtksourceview4  meta-oe/gnome/gnome/gtksourceview4.sh
+gtksourceview-classic-light meta-oe/gnome/gnome/gtksourceview-classic-light.sh
+gvfs	meta-oe/gnome/gnome/gvfs.sh
+libchamplain	meta-oe/gnome/gnome/libchamplain.sh
+libgdata	meta-oe/gnome/gnome/libgdata.sh
+libgsf	meta-oe/gnome/gnome/libgsf.sh
+libgtkstylus	meta-oe/gnome/gnome/libgtkstylus.sh
+libgtop	meta-oe/gnome/gnome/libgtop.sh
+libgweather	meta-oe/gnome/gnome/libgweather.sh
+libtimezonemap	meta-oe/gnome/gnome/libtimezonemap.sh
+libwnck	meta-oe/gnome/gnome/libwnck.sh
+libwnck3 meta-oe/gnome/gnome/libwnck3.sh
+libxklavier	meta-oe/gnome/gnome/libxklavier.sh
+metacity	meta-oe/gnome/gnome/metacity.sh
+mutter	meta-oe/gnome/gnome/mutter.sh
+nautilus	meta-oe/gnome/gnome/nautilus.sh
+rest	meta-oe/gnome/gnome/rest.sh
+sysprof	meta-oe/gnome/gnome/sysprof.sh
+tepl	meta-oe/gnome/gnome/tepl.sh
+tracker	meta-oe/gnome/gnome/tracker.sh
+tracker-miners meta-oe/gnome/gnome/tracker-miners.sh
+yelp	meta-oe/gnome/gnome/yelp.sh
+yelp-tools meta-oe/gnome/gnome/yelp-tools.sh
+yelp-xsl meta-oe/gnome/gnome/yelp-xsl.sh
+zenity	meta-oe/gnome/gnome/zenity.sh

+ 13 - 11
ltp/runtest/meta-oe.gnome.support

@@ -1,12 +1,14 @@
 	.sh
-accountsservice	accountsservice.sh
-appstream-glib	appstream-glib.sh
-colord-gtk	colord-gtk.sh
-ibus	ibus.sh
-keybinder	keybinder.sh
-libstemmer	libstemmer.sh
-libuser	libuser.sh
-libwacom	libwacom.sh
-onboard	onboard.sh
-packagegroups	packagegroups.sh
-usermode	usermode.sh
+accountsservice	meta-oe/gnome/support/accountsservice.sh
+appstream-glib	meta-oe/gnome/support/appstream-glib.sh
+colord-gtk	meta-oe/gnome/support/colord-gtk.sh
+ibus	meta-oe/gnome/support/ibus.sh
+ibus-native meta-oe/gnome/support/ibus-native.sh
+keybinder	meta-oe/gnome/support/keybinder.sh
+libstemmer	meta-oe/gnome/support/libstemmer.sh
+libuser	meta-oe/gnome/support/libuser.sh
+libwacom	meta-oe/gnome/support/libwacom.sh
+onboard	meta-oe/gnome/support/onboard.sh
+packagegroups	meta-oe/gnome/support/packagegroups.sh
+packagegroup-gnome-desktop meta-oe/gnome/support/packagegroup-gnome-desktop.sh
+usermode	meta-oe/gnome/support/usermode.sh

+ 8 - 3
ltp/runtest/meta-oe.multimedia.connectivity

@@ -1,4 +1,9 @@
 	.sh
-gupnp	gupnp.sh
-libupnp	libupnp.sh
-rygel	rygel.sh
+gssdp	meta-oe/multimedia/connectivity/gssdp.sh
+gupnp  meta-oe/multimedia/connectivity/gupnp.sh
+gupnp-av  meta-oe/multimedia/connectivity/gupnp-av.sh
+gupnp-dlna meta-oe/multimedia/connectivity/gupnp-dlna.sh
+gupnp-igd meta-oe/multimedia/connectivity/gupnp-igd.sh
+gupnp-tools meta-oe/multimedia/connectivity/gupnp-tools.sh 
+libupnp	meta-oe/multimedia/connectivity/libupnp.sh
+rygel	meta-oe/multimedia/connectivity/rygel.sh

+ 62 - 47
ltp/runtest/meta-oe.multimedia.multimedia

@@ -1,48 +1,63 @@
 	.sh
-alsa-equal	alsa-equal.sh
-aom	aom.sh
-caps	caps.sh
-cdparanoia	cdparanoia.sh
-dca	dca.sh
-dleyna	dleyna.sh
-dvb-apps	dvb-apps.sh
-faac	faac.sh
-fdk-aac	fdk-aac.sh
-fluidsynth	fluidsynth.sh
-gerbera	gerbera.sh
-gstreamer-1.0	gstreamer-1.0.sh
-images	images.sh
-juce	juce.sh
-libao	libao.sh
-libavc1394	libavc1394.sh
-libcamera	libcamera.sh
-libdc1394	libdc1394.sh
-libde265	libde265.sh
-libdvbcsa	libdvbcsa.sh
-libdvbpsi	libdvbpsi.sh
-libdvdnav	libdvdnav.sh
-libiec61883	libiec61883.sh
-libopenmpt	libopenmpt.sh
-libsquish	libsquish.sh
-libuvc	libuvc.sh
-mimic	mimic.sh
-minidlna	minidlna.sh
-musicbrainz	musicbrainz.sh
-musicpd	musicpd.sh
-mycroft	mycroft.sh
-openal	openal.sh
-opencore-amr	opencore-amr.sh
-openh264	openh264.sh
-opusfile	opusfile.sh
-packagegroups	packagegroups.sh
-rtmpdump	rtmpdump.sh
-sample-content	sample-content.sh
-schroedinger	schroedinger.sh
-sox	sox.sh
-streamripper	streamripper.sh
-tinyalsa	tinyalsa.sh
-tremor	tremor.sh
-vlc	vlc.sh
-vorbis-tools	vorbis-tools.sh
-webrtc-audio-processing	webrtc-audio-processing.sh
-x265	x265.sh
+alsa-equal	meta-oe/multimedia/multimedia/alsa-equal.sh
+aom	meta-oe/multimedia/multimedia/aom.sh
+caps	meta-oe/multimedia/multimedia/caps.sh
+cdparanoia	meta-oe/multimedia/multimedia/cdparanoia.sh
+dca	meta-oe/multimedia/multimedia/dcadec.sh
+dleyna-connector-dbus	meta-oe/multimedia/multimedia/dleyna-connector-dbus.sh
+dleyna-core meta-oe/multimedia/multimedia/dleyna-core.sh
+dleyna-renderer meta-oe/multimedia/multimedia/dleyna-renderer.sh
+dleyna-server meta-oe/multimedia/multimedia/dleyna-server.sh
+dvb-apps	meta-oe/multimedia/multimedia/dvb-apps.sh
+faac	meta-oe/multimedia/multimedia/faac.sh
+fdk-aac	meta-oe/multimedia/multimedia/fdk-aac.sh
+fluidsynth	meta-oe/multimedia/multimedia/fluidsynth.sh
+fluidsynth-native meta-oe/multimedia/multimedia/fluidsynth-native.sh
+gerbera	meta-oe/multimedia/multimedia/gerbera.sh
+gstd	meta-oe/multimedia/multimedia/gstd.sh
+gst-shark meta-oe/multimedia/multimedia/gst-shark.sh 
+images	meta-oe/multimedia/multimedia/meta-multimedia-image-base.sh meta-oe/multimedia/multimedia/meta-multimedia-image.sh meta-oe/multimedia/multimedia/multimedia-libcamera-image.sh
+juce	meta-oe/multimedia/multimedia/projucer.sh
+libao	meta-oe/multimedia/multimedia/libao.sh
+libavc1394	meta-oe/multimedia/multimedia/libavc1394.sh
+libcamera	meta-oe/multimedia/multimedia/libcamera.sh
+libdc1394	meta-oe/multimedia/multimedia/libdc1394.sh
+libde265	meta-oe/multimedia/multimedia/libde265.sh
+libdvbcsa	meta-oe/multimedia/multimedia/libdvbcsa.sh
+libdvbpsi	meta-oe/multimedia/multimedia/libdvbpsi.sh
+libdvdnav	meta-oe/multimedia/multimedia/libdvdnav.sh
+libiec61883	meta-oe/multimedia/multimedia/libiec61883.sh
+libopenmpt	meta-oe/multimedia/multimedia/libopenmpt.sh
+libsquish	meta-oe/multimedia/multimedia/libsquish.sh
+libuvc	meta-oe/multimedia/multimedia/libuvc.sh
+mimic	meta-oe/multimedia/multimedia/mimic.sh
+minidlna	meta-oe/multimedia/multimedia/minidlna.sh
+musicbrainz	meta-oe/multimedia/multimedia/libmusicbrainz.sh
+musicpd	meta-oe/multimedia/multimedia/libmpd.sh
+libmpdclient meta-oe/multimedia/multimedia/libmpdclient.sh
+mpc meta-oe/multimedia/multimedia/mpc.sh
+mpd meta-oe/multimedia/multimedia/mpd.sh
+ncmpc meta-oe/multimedia/multimedia/ncmpc.sh
+mycroft	meta-oe/multimedia/multimedia/mycroft.sh
+openal	meta-oe/multimedia/multimedia/openal-soft.sh
+opencore-amr	meta-oe/multimedia/multimedia/opencore-amr.sh
+vo-aacenc meta-oe/multimedia/multimedia/vo-aacenc.sh
+vo-amrwbenc meta-oe/multimedia/multimedia/vo-amrwbenc.sh
+openh264	meta-oe/multimedia/multimedia/openh264.sh
+opusfile	meta-oe/multimedia/multimedia/opusfile.sh
+packagegroups	meta-oe/multimedia/multimedia/packagegroup-meta-multimedia.sh
+rtmpdump	meta-oe/multimedia/multimedia/rtmpdump.sh
+sample-content	meta-oe/multimedia/multimedia/bigbuckbunny-1080p.sh
+bigbuckbunny-480p meta-oe/multimedia/multimedia/bigbuckbunny-480p.sh
+bigbuckbunny-720p meta-oe/multimedia/multimedia/bigbuckbunny-720p.sh
+tearsofsteel-1080p meta-oe/multimedia/multimedia/tearsofsteel-1080p.sh
+schroedinger	meta-oe/multimedia/multimedia/schroedinger.sh
+sox	meta-oe/multimedia/multimedia/sox.sh
+streamripper	meta-oe/multimedia/multimedia/streamripper.sh
+tinyalsa	meta-oe/multimedia/multimedia/tinyalsa.sh
+tremor	meta-oe/multimedia/multimedia/tremor.sh
+vlc	meta-oe/multimedia/multimedia/libdvdcss.sh
+vlc meta-oe/multimedia/multimedia/vlc.sh
+vorbis-tools	meta-oe/multimedia/multimedia/vorbis-tools.sh
+webrtc-audio-processing	meta-oe/multimedia/multimedia/webrtc-audio-processing.sh
+x265	meta-oe/multimedia/multimedia/x265.sh

+ 5 - 5
ltp/runtest/meta-oe.multimedia.support

@@ -1,5 +1,5 @@
-crossguid	crossguid.sh
-gst-instruments	gst-instruments.sh
-libmediaart	libmediaart.sh
-libsrtp	libsrtp.sh
-srt	srt.sh
+crossguid	meta-oe/multimedia/support/crossguid.sh
+gst-instruments	meta-oe/multimedia/support/gst-instruments.sh
+libmediaart	meta-oe/multimedia/support/libmediaart.sh meta-oe/multimedia/support/libmediaart-2.0.sh
+libsrtp	meta-oe/multimedia/support/libsrtp.sh
+srt	meta-oe/multimedia/support/srt.sh

+ 1 - 7
ltp/runtest/mm

@@ -70,16 +70,10 @@ ksm04_1 ksm04 -u 128
 ksm05 ksm05 -I 10
 ksm06 ksm06
 ksm06_1 ksm06 -n 10
-ksm06_2 ksm06 -n 8000
+ksm06_2 ksm06 -n 10000
 
 cpuset01 cpuset01
 
-oom01 oom01
-oom02 oom02
-oom03 oom03
-oom04 oom04
-oom05 oom05
-
 swapping01 swapping01 -i 5
 
 thp01 thp01 -I 120

+ 0 - 5
ltp/runtest/net.features

@@ -78,8 +78,3 @@ mpls03_ipv6 mpls03.sh -6
 mpls04 mpls04.sh
 
 fanout01 fanout01
-
-wireguard01 wireguard01.sh
-wireguard01_ipv6 wireguard01.sh -6
-wireguard02 wireguard02.sh
-wireguard02_ipv6 wireguard02.sh -6

+ 24 - 24
ltp/runtest/net_stress.multicast

@@ -2,28 +2,28 @@
 # Stress test for TCP/IP protocol stack (Multicast)
 #
 
-mcast4-group-single-socket mcast-group-single-socket.sh
-mcast4-group-multiple-socket mcast-group-multiple-socket.sh
-mcast4-group-same-group mcast-group-same-group.sh
-mcast4-group-source-filter mcast-group-source-filter.sh
-mcast4-pktfld01 mcast-pktfld01.sh
-mcast4-pktfld02 mcast-pktfld02.sh
-mcast4-queryfld01 mcast-queryfld01.sh
-mcast4-queryfld02 mcast-queryfld02.sh
-mcast4-queryfld03 mcast-queryfld03.sh
-mcast4-queryfld04 mcast-queryfld04.sh
-mcast4-queryfld05 mcast-queryfld05.sh
-mcast4-queryfld06 mcast-queryfld06.sh
+mcast4-group-single-socket mcast-group-single-socket
+mcast4-group-multiple-socket mcast-group-multiple-socket
+mcast4-group-same-group mcast-group-same-group
+mcast4-group-source-filter mcast-group-source-filter
+mcast4-pktfld01 mcast4-pktfld01
+mcast4-pktfld02 mcast4-pktfld02
+mcast4-queryfld01 mcast4-queryfld01
+mcast4-queryfld02 mcast4-queryfld02
+mcast4-queryfld03 mcast4-queryfld03
+mcast4-queryfld04 mcast4-queryfld04
+mcast4-queryfld05 mcast4-queryfld05
+mcast4-queryfld06 mcast4-queryfld06
 
-mcast6-group-single-socket mcast-group-single-socket.sh -6
-mcast6-group-multiple-socket mcast-group-multiple-socket.sh -6
-mcast6-group-same-group mcast-group-same-group.sh -6
-mcast6-group-source-filter mcast-group-source-filter.sh -6
-mcast6-pktfld01 mcast-pktfld01.sh -6
-mcast6-pktfld02 mcast-pktfld02.sh -6
-mcast6-queryfld01 mcast-queryfld01.sh -6
-mcast6-queryfld02 mcast-queryfld02.sh -6
-mcast6-queryfld03 mcast-queryfld03.sh -6
-mcast6-queryfld04 mcast-queryfld04.sh -6
-mcast6-queryfld05 mcast-queryfld05.sh -6
-mcast6-queryfld06 mcast-queryfld06.sh -6
+mcast6-group-single-socket mcast-group-single-socket -6
+mcast6-group-multiple-socket mcast-group-multiple-socket -6
+mcast6-group-same-group mcast-group-same-group -6
+mcast6-group-source-filter mcast-group-source-filter -6
+mcast6-pktfld01 mcast6-pktfld01
+mcast6-pktfld02 mcast6-pktfld02
+mcast6-queryfld01 mcast6-queryfld01
+mcast6-queryfld02 mcast6-queryfld02
+mcast6-queryfld03 mcast6-queryfld03
+mcast6-queryfld04 mcast6-queryfld04
+mcast6-queryfld05 mcast6-queryfld05
+mcast6-queryfld06 mcast6-queryfld06

+ 4 - 2
ltp/runtest/net_stress.route

@@ -5,7 +5,8 @@ route4-change-if route-change-if.sh
 route4-change-netlink-dst route-change-netlink-dst.sh
 route4-change-netlink-gw route-change-netlink-gw.sh
 route4-change-netlink-if route-change-netlink-if.sh
-route4-redirect route-redirect.sh
+route4-redirect route4-redirect
+route4-rmmod route4-rmmod
 
 route6-change-dst route-change-dst.sh -6
 route6-change-gw route-change-gw.sh -6
@@ -13,4 +14,5 @@ route6-change-if route-change-if.sh -6
 route6-change-netlink-dst route-change-netlink-dst.sh -6
 route6-change-netlink-gw route-change-netlink-gw.sh -6
 route6-change-netlink-if route-change-netlink-if.sh -6
-route6-redirect route-redirect.sh -6
+route6-redirect route6-redirect
+route6-rmmod route6-rmmod

File diff suppressed because it is too large
+ 23 - 5
ltp/runtest/oe-core.core


+ 0 - 1
ltp/runtest/oe-core.graphics

@@ -1,4 +1,3 @@
-	.sh
 builder	builder.sh
 cairo	cairo.sh
 cantarell-fonts	cantarell-fonts.sh

File diff suppressed because it is too large
+ 7 - 1
ltp/runtest/oe-core.multimedia


+ 3 - 1
ltp/runtest/oe-core.sato

@@ -15,4 +15,6 @@ rxvt-unicode	oe-core/sato/rxvt-unicode.sh
 sato-screenshot	oe-core/sato/sato-screenshot.sh
 settings-daemon	oe-core/sato/settings-daemon.sh
 shutdown-desktop	oe-core/sato/shutdown-desktop.sh
-webkit	oe-core/sato/libwpe.sh oe-core/sato/webkitgtk.sh oe-core/sato/wpebackend-fdo.sh
+webkit	oe-core/sato/libwpe.sh
+webkitgtk oe-core/sato/webkitgtk.sh
+wpebackend-fdo oe-core/sato/wpebackend-fdo.sh

+ 17 - 8
ltp/runtest/oe-core.support

@@ -1,11 +1,16 @@
-apr	oe-core/support/apr.sh oe-core/support/apr-util.sh
+apr	oe-core/support/apr.sh
+apr-util oe-core/support/apr-util.sh
 argp-standalone	oe-core/support/argp-standalone.sh
 aspell	oe-core/support/aspell.sh
-atk	oe-core/support/atk.sh  oe-core/support/at-spi2-atk.sh oe-core/support/at-spi2-core.sh
-attr	oe-core/support/acl.sh oe-core/support/attr.sh
+atk	oe-core/support/atk.sh
+at-spi2-atk  oe-core/support/at-spi2-atk.sh
+at-spi2-core oe-core/support/at-spi2-core.sh
+attr	oe-core/support/acl.sh
+attr oe-core/support/attr.sh
 bash-completion	oe-core/support/bash-completion.sh
 bmap-tools	oe-core/support/bmap-tools.sh
-boost	oe-core/support/boost.sh oe-core/support/boost-build-native.sh
+boost	oe-core/support/boost.sh
+boost-build-native oe-core/support/boost-build-native.sh
 ca-certificates	oe-core/support/ca-certificates.sh
 consolekit	oe-core/support/consolekit.sh
 curl	oe-core/support/curl.sh
@@ -19,7 +24,8 @@ gdbm	oe-core/support/gdbm.sh
 gmp	oe-core/support/gmp.sh
 gnome-desktop-testing	oe-core/support/gnome-desktop-testing.sh
 gnupg	oe-core/support/gnupg.sh
-gnutls	oe-core/support/gnutls.sh oe-core/support/libtasn1.sh
+gnutls	oe-core/support/gnutls.sh
+libtasn1 oe-core/support/libtasn1.sh
 gpgme	oe-core/support/gpgme.sh
 icu	oe-core/support/icu.sh
 iso-codes	oe-core/support/iso-codes.sh
@@ -28,7 +34,8 @@ libassuan	oe-core/support/libassuan.sh
 libatomic-ops	oe-core/support/libatomic-ops.sh
 libbsd	oe-core/support/libbsd.sh
 libcap	oe-core/support/libcap.sh
-libcap-ng	oe-core/support/libcap-ng.sh oe-core/support/libcap-ng-python.sh
+libcap-ng	oe-core/support/libcap-ng.sh
+libcap-ng-python oe-core/support/libcap-ng-python.sh
 libcheck	oe-core/support/libcheck.sh
 libcroco	oe-core/support/libcroco.sh
 libdaemon	oe-core/support/libdaemon.sh
@@ -36,7 +43,8 @@ libevdev	oe-core/support/libevdev.sh
 libevent	oe-core/support/libevent.sh
 libexif	oe-core/support/libexif.sh
 libffi	oe-core/support/libffi.sh
-libfm	oe-core/support/libfm.sh oe-core/support/libfm-extra.sh
+libfm	oe-core/support/libfm.sh
+libfm-extra oe-core/support/libfm-extra.sh
 libgcrypt	oe-core/support/libgcrypt.sh
 libgpg-error	oe-core/support/libgpg-error.sh
 libical	oe-core/support/libical.sh
@@ -44,7 +52,8 @@ libjitterentropy	oe-core/support/libjitterentropy.sh
 libksba	oe-core/support/libksba.sh
 libmpc	oe-core/support/libmpc.sh
 libnl	oe-core/support/libnl.sh
-libpcre	oe-core/support/libpcre2.sh oe-core/support/libpcre.sh
+libpcre	oe-core/support/libpcre2.sh
+libpcre oe-core/support/libpcre.sh
 libproxy	oe-core/support/libproxy.sh
 libpsl	oe-core/support/libpsl.sh
 libsoup	oe-core/support/libsoup.sh

+ 1 - 0
ltp/runtest/start_test

@@ -0,0 +1 @@
+start_test start_test.sh

+ 10 - 33
ltp/runtest/syscalls

@@ -44,7 +44,6 @@ bpf_prog03 bpf_prog03
 bpf_prog04 bpf_prog04
 
 brk01 brk01
-brk02 brk02
 
 capget01 capget01
 capget02 capget02
@@ -121,9 +120,6 @@ close01 close01
 close02 close02
 close08 close08
 
-close_range01 close_range01
-close_range02 close_range02
-
 confstr01 confstr01
 
 connect01 connect01
@@ -331,9 +327,6 @@ fgetxattr01 fgetxattr01
 fgetxattr02 fgetxattr02
 fgetxattr03 fgetxattr03
 
-finit_module01 finit_module01
-finit_module02 finit_module02
-
 flistxattr01 flistxattr01
 flistxattr02 flistxattr02
 flistxattr03 flistxattr03
@@ -417,6 +410,9 @@ getcwd04 getcwd04
 getdents01 getdents01
 getdents02 getdents02
 
+getdents01_64 getdents01 -l
+getdents02_64 getdents02 -l
+
 getdomainname01 getdomainname01
 
 getdtablesize01 getdtablesize01
@@ -493,7 +489,6 @@ getrlimit02 getrlimit02
 getrlimit03 getrlimit03
 
 get_mempolicy01 get_mempolicy01
-get_mempolicy02 get_mempolicy02
 get_robust_list01 get_robust_list01
 
 getrusage01 getrusage01
@@ -525,9 +520,6 @@ getxattr03 getxattr03
 getxattr04 getxattr04
 getxattr05 getxattr05
 
-init_module01 init_module01
-init_module02 init_module02
-
 #Needs tty device.
 #ioctl01 ioctl01 -D /dev/tty0
 #ioctl02 ioctl02 -D /dev/tty0
@@ -590,9 +582,6 @@ fanotify13 fanotify13
 fanotify14 fanotify14
 fanotify15 fanotify15
 fanotify16 fanotify16
-fanotify17 fanotify17
-fanotify18 fanotify18
-fanotify19 fanotify19
 
 ioperm01 ioperm01
 ioperm02 ioperm02
@@ -690,9 +679,6 @@ lstat01_64 lstat01_64
 lstat02 lstat02
 lstat02_64 lstat02_64
 
-mallinfo01 mallinfo01
-mallinfo02 mallinfo02
-
 mallopt01 mallopt01
 
 mbind01 mbind01
@@ -817,7 +803,6 @@ msgctl02 msgctl02
 msgctl03 msgctl03
 msgctl04 msgctl04
 msgctl05 msgctl05
-msgctl06 msgctl06
 msgstress01 msgstress01
 msgstress02 msgstress02
 msgstress03 msgstress03
@@ -861,9 +846,6 @@ nanosleep01 nanosleep01
 nanosleep02 nanosleep02
 nanosleep04 nanosleep04
 
-name_to_handle_at01 name_to_handle_at01
-name_to_handle_at02 name_to_handle_at02
-
 nftw01 nftw01
 nftw6401 nftw6401
 
@@ -897,9 +879,6 @@ openat201 openat201
 openat202 openat202
 openat203 openat203
 
-open_by_handle_at01 open_by_handle_at01
-open_by_handle_at02 open_by_handle_at02
-
 open_tree01 open_tree01
 open_tree02 open_tree02
 
@@ -1011,7 +990,6 @@ pselect03 pselect03
 pselect03_64 pselect03_64
 
 ptrace01 ptrace01
-ptrace02 ptrace02
 ptrace03 ptrace03
 ptrace04 ptrace04
 ptrace05 ptrace05
@@ -1020,8 +998,6 @@ ptrace05 ptrace05
 ptrace07 ptrace07
 ptrace08 ptrace08
 ptrace09 ptrace09
-ptrace10 ptrace10
-ptrace11 ptrace11
 
 pwrite01 pwrite01
 pwrite02 pwrite02
@@ -1089,8 +1065,6 @@ recvmsg01 recvmsg01
 recvmsg02 recvmsg02
 recvmsg03 recvmsg03
 
-recvmmsg01 recvmmsg01
-
 remap_file_pages01 remap_file_pages01
 remap_file_pages02 remap_file_pages02
 
@@ -1151,6 +1125,7 @@ sched_get_priority_min01 sched_get_priority_min01
 sched_get_priority_min02 sched_get_priority_min02
 
 sched_getparam01 sched_getparam01
+sched_getparam02 sched_getparam02
 sched_getparam03 sched_getparam03
 
 sched_rr_get_interval01 sched_rr_get_interval01
@@ -1192,7 +1167,6 @@ semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
 semctl08 semctl08
-semctl09 semctl09
 
 semget01 semget01
 semget02 semget02
@@ -1230,7 +1204,6 @@ sendmsg02 sendmsg02
 sendmsg03 sendmsg03
 
 sendmmsg01 sendmmsg01
-sendmmsg02 sendmmsg02
 
 sendto01 sendto01
 sendto02 sendto02
@@ -1505,6 +1478,8 @@ symlink05 symlink05
 symlinkat01 symlinkat01
 
 sync01 sync01
+sync02 sync02
+sync03 sync03
 
 syncfs01 syncfs01
 
@@ -1549,6 +1524,7 @@ tgkill02 tgkill02
 tgkill03 tgkill03
 
 time01 time01
+time02 time02
 
 times01 times01
 times03 times03
@@ -1581,6 +1557,8 @@ timer_settime03 timer_settime03
 tkill01 tkill01
 tkill02 tkill02
 
+truncate01 truncate01
+truncate01_64 truncate01_64
 truncate02 truncate02
 truncate02_64 truncate02_64
 truncate03 truncate03
@@ -1596,6 +1574,7 @@ umask01 umask01
 
 uname01 uname01
 uname02 uname02
+uname03 uname03
 uname04 uname04
 
 unlink01 symlink01 -T unlink01
@@ -1683,7 +1662,6 @@ write05 write05
 
 writev01 writev01
 writev02 writev02
-writev03 writev03
 writev05 writev05
 writev06 writev06
 writev07 writev07
@@ -1724,4 +1702,3 @@ statx07 statx07
 membarrier01 membarrier01
 
 io_uring01 io_uring01
-io_uring02 io_uring02

+ 0 - 2
ltp/runtest/syscalls-ipc

@@ -3,7 +3,6 @@ msgctl02 msgctl02
 msgctl03 msgctl03
 msgctl04 msgctl04
 msgctl05 msgctl05
-msgctl06 msgctl06
 msgstress01 msgstress01
 msgstress02 msgstress02
 msgstress03 msgstress03
@@ -37,7 +36,6 @@ semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
 semctl08 semctl08
-semctl09 semctl09
 
 semget01 semget01
 semget02 semget02

+ 43 - 4
ltp/scenario_groups/default

@@ -1,5 +1,44 @@
-test
-vim_test
-meta-oe.xfce.apps
-#oe-core.core
+start_test
+oe-core.connectivity
+oe-core.core
+oe-core.core1
+oe-core.devtools
 oe-core.extended
+oe-core.gnome
+oe-core.graphics
+oe-core.multimedia
+oe-core.sato
+oe-core.support
+meta-oe.gnome.connectivity
+meta-oe.gnome.extended
+meta-oe.gnome.gimp
+meta-oe.gnome.gnome
+meta-oe.gnome.support
+meta-oe.multimedia.connectivity
+meta-oe.multimedia.multimedia
+meta-oe.multimedia.support
+meta-oe.networking.connectivity
+meta-oe.networking.core
+meta-oe.networking.daemons
+meta-oe.networking.devtools
+meta-oe.networking.extended
+meta-oe.networking.filter
+meta-oe.networking.irc
+meta-oe.networking.kernel
+meta-oe.networking.netkit
+meta-oe.networking.protocols
+meta-oe.networking.support
+meta-oe.webserver.core
+meta-oe.webserver.httpd
+meta-oe.webserver.php
+meta-oe.webserver.support
+meta-oe.webserver.webadmin
+meta-oe.xfce.apps
+meta-oe.xfce.art
+meta-oe.xfce.bindings
+meta-oe.xfce.core
+meta-oe.xfce.extended
+meta-oe.xfce.multimedia
+meta-oe.xfce.panel-plugins
+meta-oe.xfce.thunar-plugins
+meta-oe.xfce.xfce

+ 2 - 2
ltp/testcases/bin/bbr01.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2018-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
 
 TST_SETUP="setup"
 TST_TESTFUNC="do_test"
@@ -27,7 +27,7 @@ setup()
 
 do_test()
 {
-	tcp_cc_test01 bbr -100
+	tcp_cc_test01 bbr -50
 }
 
 tst_run

+ 2 - 2
ltp/testcases/bin/bbr02.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2018-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
 
 TST_SETUP="setup"
 TST_TESTFUNC="do_test"
@@ -34,7 +34,7 @@ setup()
 do_test()
 {
 	tcp_cc_set_qdisc $2 || return
-	tcp_cc_test01 bbr -100
+	tcp_cc_test01 bbr -50
 }
 
 tst_run

+ 8 - 2
ltp/testcases/bin/busy_poll01.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2015-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
 #
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
@@ -47,7 +47,13 @@ test()
 		tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x
 	done
 
-	tst_netload_compare $(cat res_0) $(cat res_50) 1
+	local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
+
+	if [ "$poll_cmp" -lt 1 ]; then
+		tst_res TFAIL "busy poll result is '$poll_cmp' %"
+	else
+		tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
+	fi
 }
 
 tst_run

+ 8 - 2
ltp/testcases/bin/busy_poll02.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2015-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
 #
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
@@ -37,7 +37,13 @@ test()
 		tst_netload -H $(tst_ipaddr rhost) -n 10 -N 10 -d res_$x -b $x
 	done
 
-	tst_netload_compare $(cat res_0) $(cat res_50) 1
+	local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
+
+	if [ "$poll_cmp" -lt 1 ]; then
+		tst_res TFAIL "busy poll result is '$poll_cmp' %"
+	else
+		tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
+	fi
 }
 
 tst_run

+ 8 - 2
ltp/testcases/bin/busy_poll03.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2016-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2016-2018 Oracle and/or its affiliates.
 #
 # Author: Alexey Kodanev <alexey.kodanev@oracle.com>
 
@@ -40,7 +40,13 @@ test()
 			    -b $x -T $2
 	done
 
-	tst_netload_compare $(cat res_0) $(cat res_50) 1
+	local poll_cmp=$(( 100 - ($(cat res_50) * 100) / $(cat res_0) ))
+
+	if [ "$poll_cmp" -lt 1 ]; then
+		tst_res TFAIL "busy poll result is '$poll_cmp' %"
+	else
+		tst_res TPASS "busy poll increased performance by '$poll_cmp' %"
+	fi
 }
 
 tst_run

+ 106 - 0
ltp/testcases/bin/can_run_tests.sh

@@ -0,0 +1,106 @@
+#!/bin/sh
+################################################################################
+## Copyright (c) Oliver Hartkopp <oliver.hartkopp@volkswagen.de>, 2011        ##
+## Copyright (c) International Business Machines  Corp., 2009                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software Foundation,   ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA           ##
+##                                                                            ##
+################################################################################
+
+TCID="$1"
+TST_TOTAL=1
+export TST_COUNT
+
+. test.sh
+
+setup()
+{
+	tst_require_root
+
+	# load needed CAN networklayer modules
+	modprobe can
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		tst_brkm TCONF "modprobe can failed: ret - $ret"
+	fi
+
+	modprobe can_raw
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		tst_brkm TCONF "modprobe can_raw failed: ret - $ret"
+	fi
+
+	# ensure the vcan driver to perform the ECHO on driver level
+	modprobe -r vcan
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		tst_brkm TCONF "modprobe -r vcan failed: ret - $ret"
+	fi
+
+	modprobe vcan echo=1
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		tst_brkm TCONF "modprobe vcan echo=1 failed: ret - $ret"
+	fi
+
+	VCAN=vcan0
+
+	# create virtual CAN device
+	ip link add dev $VCAN type vcan
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		tst_brkm TBROK \
+			 "ip link add dev $VCAN type vcan failed: ret - $ret"
+	fi
+
+	ip link set dev $VCAN up
+	ret=$?
+	if [ $ret -ne 0 ]; then
+		tst_brkm TBROK "ip link set dev $VCAN up failed: ret - $ret"
+	fi
+
+	# check precondition for CAN frame flow test
+	HAS_ECHO=`ip link show $VCAN | grep -c ECHO`
+	if [ $HAS_ECHO -ne 1 ]; then
+		tst_brkm TBROK "ECHO is not 1"
+	fi
+}
+
+cleanup()
+{
+	ip link set dev $VCAN down
+	ip link del dev $VCAN
+	modprobe -r vcan
+	modprobe -r can_raw
+	modprobe -r can
+}
+
+if [ $# -ne 1 ]; then
+	tst_brkm TBROK "Usage: $0 [can_filter | can_rcv_own_msgs]"
+fi
+
+setup
+TST_CLEANUP=cleanup
+
+"$1" "$VCAN"
+ret=$?
+case "$ret" in
+0)	tst_resm TPASS "Test $1 PASS";;
+1)	tst_resm TFAIL "Test $1 FAIL";;
+32)	tst_resm TCONF "$1 is not appropriate for configuration flag";;
+*)	tst_resm TBROK "Invalid resm type $ret";;
+esac
+
+tst_exit

+ 3 - 3
ltp/testcases/bin/cmdlib.sh

@@ -103,8 +103,8 @@ exists()
 {
     for cmd in $*; do
         if ! command -v $cmd >/dev/null 2>&1; then
-            tst_resm TCONF "$1: command $2 not found."
-            exit 32
+            end_testcase "$cmd: command not found"
+            exit 1
         fi
     done
 }
@@ -118,7 +118,7 @@ tst_require_root()
 {
 	if [ "x$(id -u)" != "x0" ]; then
 		tst_resm TCONF "You must be root to execute this test"
-		exit 32
+		exit 0
 	fi
 }
 

+ 9 - 0
ltp/testcases/bin/connector_test.sh

@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if [ ! -f /proc/net/connector ];then
+	echo "Connectors 0 CONF : system doesn't support execution of the test"
+	exit 32
+fi
+
+$LTPROOT/testcases/bin/run_pec_test
+

+ 1 - 17
ltp/testcases/bin/cpio_tests.sh

@@ -1,29 +1,13 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2003-2021
 #
 # Test basic functionality of cpio command
 
 TST_TESTFUNC=cpio_test
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_CMDS="cpio"
-TST_SETUP="setup"
 . tst_test.sh
 
-
-setup()
-{
-	if ! cpio --help 2>&1 | grep -q -- '-o.*Create'; then
-		tst_brk TCONF "-o flag not supported"
-	fi
-
-	ARCHIVE_FORMAT=
-
-	if cpio 2>&1 | grep -q 'BusyBox'; then
-		ARCHIVE_FORMAT="-H newc"
-	fi
-}
-
 cpio_test()
 {
 	ROD mkdir "dir"
@@ -32,7 +16,7 @@ cpio_test()
 	done
 
 	ROD find dir -type f > filelist
-	EXPECT_PASS cpio -o $ARCHIVE_FORMAT \> cpio.out \< filelist
+	EXPECT_PASS cpio -o \> cpio.out \< filelist
 	ROD mv "dir" "dir_orig"
 	ROD mkdir "dir"
 	EXPECT_PASS cpio -i \< cpio.out

+ 5 - 36
ltp/testcases/bin/cpuset_funcs.sh

@@ -26,34 +26,15 @@
 
 . test.sh
 
-cpu_string="`cat /sys/devices/system/cpu/online`"
 NR_CPUS=`tst_ncpus`
-
 if [ -f "/sys/devices/system/node/has_high_memory" ]; then
-	mem_string="`cat /sys/devices/system/node/has_high_memory`"
+	N_NODES="`cat /sys/devices/system/node/has_high_memory`"
 else
-	mem_string="`cat /sys/devices/system/node/has_normal_memory`"
+	N_NODES="`cat /sys/devices/system/node/has_normal_memory`"
 fi
-N_NODES="`echo $mem_string | tr ',' ' '`"
-count=0
-final_node=0
-for item in $N_NODES; do
-	delta=1
-	if [ "${item#*-*}" != "$item" ]; then
-		delta=$((${item#*-*} - ${item%*-*} + 1))
-	fi
-	final_node=${item#*-*}
-	count=$((count + $delta))
-done
-final_node=$((final_node + 1))
-N_NODES=$count
-
-final_cpu=0
-N_CPUS="`echo $cpu_string | tr ',' ' '`"
-for item in $N_CPUS; do
-	final_cpu=${item#*-*}
-done
-final_cpu=$((final_cpu + 1))
+mem_string="$N_NODES"
+N_NODES=${N_NODES#*-*}
+N_NODES=$(($N_NODES + 1))
 
 CPUSET="/dev/cpuset"
 CPUSET_TMP="/tmp/cpuset_tmp"
@@ -89,12 +70,6 @@ ncpus_check()
 	if [ $NR_CPUS -lt $1 ]; then
 		tst_brkm TCONF "The total of CPUs is less than $1"
 	fi
-	# check online cpus whether match 0-num
-	if [ $final_cpu -eq $NR_CPUS ]; then
-		tst_resm TINFO "CPUs are numbered continuously starting at 0 ($cpu_string)"
-	else
-		tst_brkm TCONF "CPUs are not numbered continuously starting at 0 ($cpu_string)"
-	fi
 }
 
 nnodes_check()
@@ -102,12 +77,6 @@ nnodes_check()
 	if [ $N_NODES -lt $1 ]; then
 		tst_brkm TCONF "The total of nodes is less than $1"
 	fi
-	# check online nodes whether match 0-num
-	if [ $final_node -eq $N_NODES ]; then
-		tst_resm TINFO "Nodes are numbered continuously starting at 0 ($mem_string)"
-	else
-		tst_brkm TCONF "Nodes are not numbered continuously starting at 0 ($mem_string)"
-	fi
 }
 
 user_check()

+ 5 - 0
ltp/testcases/bin/cpuset_inherit_testset.sh

@@ -106,6 +106,11 @@ inherit_test()
 test_cpus()
 {
 	cfile_name="cpus"
+	num=$((nr_cpus-1))
+	cpu_string="0-$num"
+	if [ $nr_cpus -eq 1 ]; then
+		cpu_string="0"
+	fi
 	while read inherit cpus result
 	do
 		inherit_test "$CPUSET/1/cpuset.cpus" "$inherit" "$cpus" "$result"

+ 14 - 3
ltp/testcases/bin/dccp01.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2020 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) 2017-2018 Oracle and/or its affiliates. All Rights Reserved.
 
 TST_CNT=3
 TST_TESTFUNC="test"
@@ -9,6 +9,17 @@ TST_NEEDS_ROOT=1
 
 . tst_net.sh
 
+compare()
+{
+	local per=$(( $res0 * 100 / $res1 - 100 ))
+
+	if [ "$per" -gt "100" -o "$per" -lt "-100" ]; then
+		tst_res TFAIL "$1 performance $per %"
+	else
+		tst_res TPASS "$1 performance $per % in range -100 ... 100 %"
+	fi
+}
+
 test1()
 {
 	tst_res TINFO "run UDP"
@@ -20,14 +31,14 @@ test2()
 	tst_res TINFO "compare UDP/DCCP performance"
 	tst_netload -H $(tst_ipaddr rhost) -T dccp
 	res1="$(cat tst_netload.res)"
-	tst_netload_compare $res0 $res1 -100 100
+	compare DCCP
 }
 test3()
 {
 	tst_res TINFO "compare UDP/UDP-Lite performance"
 	tst_netload -H $(tst_ipaddr rhost) -T udp_lite
 	res1="$(cat tst_netload.res)"
-	tst_netload_compare $res0 $res1 -100 100
+	compare UDP-Lite
 }
 
 tst_run

+ 2 - 2
ltp/testcases/bin/df01.sh

@@ -101,8 +101,8 @@ df_check()
 		local free=$(stat -f mntpoint --printf=%f)
 		local used=$((total-free))
 		local bsize=$(stat -f mntpoint --printf=%s)
-		total=$((($total * $bsize + 512)/ 1024))
-		used=$((($used * $bsize + 512) / 1024))
+		total=$(($total * $bsize / 1024))
+		used=$(($used * $bsize / 1024))
 	fi
 
 	grep ${TST_DEVICE} output | grep -q "${total}.*${used}"

+ 1 - 1
ltp/testcases/bin/dnsmasq_tests.sh

@@ -12,7 +12,7 @@ dhcp_name="dnsmasq"
 log="/var/log/dnsmasq.tst.log"
 
 lease_dir="/var/lib/misc"
-tst_selinux_enforced && lease_dir="/var/lib/dnsmasq"
+tst_selinux_enabled && lease_dir="/var/lib/dnsmasq"
 lease_file="$lease_dir/dnsmasq.tst.leases"
 
 common_opt="--no-hosts --no-resolv --dhcp-authoritative \

+ 79 - 25
ltp/testcases/bin/host01.sh

@@ -1,33 +1,87 @@
 #!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
-# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020
-# Copyright (c) Manoj Iyer <manjo@mail.utexas.edu> 2003
-# Copyright (c) Robbie Williamson <robbiew@us.ibm.com> 2001
-# Copyright (c) International Business Machines  Corp., 2000
+#
+#   Copyright (c) International Business Machines  Corp., 2000
+#
+#   This program is free software;  you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#   the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program;  if not, write to the Free Software
+#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#
+#
+#  FILE   : host
+#
+#  PURPOSE: To test the basic functionality of the `host` command.
+#
+#  SETUP: If "RHOST" is not exported, then the local hostname is used.
+#
+#  HISTORY:
+#    06/06/03 Manoj Iyer manjo@mail.utexas.edu
+#      - Modified to use LTP tests APIs
+#    03/01 Robbie Williamson (robbiew@us.ibm.com)
+#      -Ported
+#
+#
+#-----------------------------------------------------------------------
 
-TST_TESTFUNC="do_test"
-TST_NEEDS_CMDS="awk grep host hostname tail"
+do_setup()
+{
+    NUMLOOPS=${NUMLOOPS:-1}
+    SLEEPTIME=${SLEEPTIME:-0}
+
+    tst_setup
 
-. tst_net.sh
+    exists awk host hostname
+
+    RHOST=${RHOST:-`hostname`}
+
+}
+
+#-----------------------------------------------------------------------
+#
+# FUNCTION:  do_test
+#
+#-----------------------------------------------------------------------
 
 do_test()
 {
-	local lhost="${HOSTNAME:-$(hostname)}"
-	local addr
-
-	tst_res TINFO "test basic functionality of the host command"
-	tst_res TINFO "lhost: $lhost"
-
-	if addr=$(host $lhost); then
-		addr=$(echo "$addr" | grep address | tail -1 | awk '{print $NF}')
-		if [ -z "$addr" ]; then
-			tst_brk TFAIL "empty address"
-		fi
-		EXPECT_PASS host $addr \>/dev/null
-	else
-		tst_brk TFAIL "host $lhost on local machine failed"
-	fi
+
+    tst_resm TINFO "test basic functionality of the \`$TC' command."
+
+    while [ $TST_COUNT -lt $NUMLOOPS ]; do
+
+        if rhost_addr=$(host $RHOST); then
+            rhost_addr=$(echo "$rhost_addr" | awk -F, '{print $NF}') >/dev/null 2>&1
+            if ! host $rhost_addr >/dev/null 2>&1; then
+                end_testcase "reverse lookup with host failed"
+            fi
+
+        else
+            end_testcase "host $RHOST on local machine failed"
+        fi
+
+        incr_tst_count
+        sleep $SLEEPTIME
+
+    done
+
 }
 
-tst_run
+#-----------------------------------------------------------------------
+# FUNCTION: MAIN
+#-----------------------------------------------------------------------
+. net_cmdlib.sh
+
+read_opts $*
+do_setup
+do_test
+end_testcase

+ 1 - 1
ltp/testcases/bin/icmp-uni-basic.sh

@@ -19,7 +19,7 @@ do_setup()
 
 do_test()
 {
-	tst_ping -s $2
+	tst_ping $(tst_iface) $(tst_ipaddr rhost) $2
 }
 
 tst_run

+ 1 - 1
ltp/testcases/bin/icmp-uni-vti.sh

@@ -18,7 +18,7 @@ do_setup()
 
 do_test()
 {
-	tst_ping -I $tst_vti -H $ip_rmt_tun -s $2
+	tst_ping $tst_vti $ip_rmt_tun $2
 }
 
 tst_run

+ 24 - 60
ltp/testcases/bin/if-mtu-change.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2017-2019 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) 2015-2017 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2005
 # Author: Mitsuru Chinen <mitch@jp.ibm.com>
@@ -10,15 +10,10 @@ TST_SETUP="do_setup"
 TST_CLEANUP="do_cleanup"
 . if-lib.sh
 
-# CHANGE_INTERVAL: The interval of the mtu change
-TST_TIMEOUT=1
-if tst_net_use_netns; then
-    CHANGE_INTERVAL=${CHANGE_INTERVAL:-100ms}
-else
-    CHANGE_INTERVAL=${CHANGE_INTERVAL:-5}
-fi
-tst_is_int $CHANGE_INTERVAL && TST_TIMEOUT=$CHANGE_INTERVAL
-TST_TIMEOUT=$(((TST_TIMEOUT + 30) * MTU_CHANGE_TIMES))
+# The interval of the mtu change [second]
+CHANGE_INTERVAL=${CHANGE_INTERVAL:-5}
+
+TST_TIMEOUT=$(((CHANGE_INTERVAL + 30) * MTU_CHANGE_TIMES))
 
 # The array of the value which MTU is changed into sequentially
 # 552 - net.ipv4.route.min_pmtu
@@ -26,55 +21,11 @@ CHANGE_VALUES="784 1142 552 1500 552 1500 552 748 552 1142 1500"
 CHANGE6_VALUES="1280 1445 1335 1390 1500 1280 1500 1280 1335 1500"
 saved_mtu=
 
-MAX_PACKET_SIZE=65507
-
-set_mtu()
-{
-	local mtu="$1"
-	local cmd="$2"
-	local ret=0
-	local iface=$(tst_iface)
-	local iface_rmt=$(tst_iface rhost)
-
-	case $cmd in
-		ifconfig) ifconfig $iface mtu $mtu || ret=1
-			tst_rhost_run -c "ifconfig $iface_rmt mtu $mtu" || ret=1
-			;;
-		ip) ip link set $iface mtu $mtu || ret=1
-			tst_rhost_run -c "ip link set $iface_rmt mtu $mtu" || ret=1
-			;;
-		*) tst_brk TBROK "unknown cmd '$cmd'"
-			;;
-	esac
-
-	return $ret
-}
-
-find_ipv4_max_packet_size()
-{
-	local min_mtu=552
-	local size=$MAX_PACKET_SIZE
-
-	set_mtu $min_mtu $CMD || tst_brk TBROK "failed to set MTU to $mtu"
-	tst_res TINFO "checking max MTU"
-	while [ $size -gt 0 ]; do
-		if ping -I $(tst_iface) -c1 -w1 -s $size $(tst_ipaddr rhost) >/dev/null; then
-			tst_res TINFO "use max MTU $size"
-			MAX_PACKET_SIZE=$size
-			return
-		fi
-		size=$((size - 500))
-	done
-	tst_brk TBROK "failed to find max MTU"
-}
-
 do_setup()
 {
-
 	[ "$TST_IPV6" ] && CHANGE_VALUES=$CHANGE6_VALUES
 	if_setup
 	saved_mtu="$(cat /sys/class/net/$(tst_iface)/mtu)"
-	[ "$TST_IPV6" ] || find_ipv4_max_packet_size
 }
 
 do_cleanup()
@@ -89,10 +40,13 @@ do_cleanup()
 test_body()
 {
 	local cmd="$CMD"
-	local msg="'$cmd' changes MTU $MTU_CHANGE_TIMES times every $CHANGE_INTERVAL"
 
-	tst_is_int $CHANGE_INTERVAL && msg="$msg seconds"
-	tst_res TINFO "$msg"
+	local iface=$(tst_iface)
+	local iface_rmt=$(tst_iface rhost)
+	[ "$TST_IPV6" ] && local netmask=64 || local netmask=16
+
+	tst_res TINFO "'$cmd' changes MTU $MTU_CHANGE_TIMES times" \
+	               "every $CHANGE_INTERVAL seconds"
 
 	mtu_array_len=$(echo $CHANGE_VALUES | wc -w)
 	local cnt=0
@@ -106,14 +60,24 @@ test_body()
 		make_background_tcp_traffic
 
 		tst_res TINFO "set MTU to $mtu $cnt/$MTU_CHANGE_TIMES"
-		if ! set_mtu $mtu $cmd; then
-			tst_res TFAIL "failed to change MTU to $mtu at $cnt time"
+		local ret=0
+		case $cmd in
+		ifconfig) ifconfig $iface mtu $mtu || ret=1
+			tst_rhost_run -c "ifconfig $iface_rmt mtu $mtu"
+		;;
+		ip) ip link set $iface mtu $mtu || ret=1
+			tst_rhost_run -c "ip link set $iface_rmt mtu $mtu"
+		;;
+		esac
+
+		if [ $? -ne 0 -o $ret -ne 0 ]; then
+			tst_res TFAIL "Failed to change the mtu at $cnt time"
 			return
 		fi
 
 		tst_sleep $CHANGE_INTERVAL
 
-		tst_ping -s "1 $((mtu / 2)) $mtu $MAX_PACKET_SIZE"
+		tst_ping $(tst_ipaddr) $(tst_ipaddr rhost) "1 1000 65507"
 	done
 }
 

+ 4 - 20
ltp/testcases/bin/ima_keys.sh

@@ -15,7 +15,8 @@ TST_CLEANUP=cleanup
 . ima_setup.sh
 
 FUNC_KEYCHECK='func=KEY_CHECK'
-REQUIRED_POLICY="^measure.*$FUNC_KEYCHECK"
+TEMPLATE_BUF='template=ima-buf'
+REQUIRED_POLICY="^measure.*($FUNC_KEYCHECK.*$TEMPLATE_BUF|$TEMPLATE_BUF.*$FUNC_KEYCHECK)"
 
 setup()
 {
@@ -27,23 +28,12 @@ cleanup()
 	tst_is_num $KEYRING_ID && keyctl clear $KEYRING_ID
 }
 
-check_policy_template()
-{
-	while read line; do
-	if echo $line | grep -q 'template=' && ! echo $line | grep -q 'template=ima-buf'; then
-		tst_res TCONF "only template=ima-buf can be specified for KEY_CHECK"
-		return 1
-	fi
-	done < $TST_TMPDIR/policy.txt
-	return 0
-}
-
 check_keys_policy()
 {
 	local pattern="$1"
 
 	if ! grep -E "$pattern" $TST_TMPDIR/policy.txt; then
-		tst_res TCONF "IMA policy must specify $pattern, $FUNC_KEYCHECK"
+		tst_res TCONF "IMA policy must specify $pattern, $FUNC_KEYCHECK, $TEMPLATE_BUF"
 		return 1
 	fi
 	return 0
@@ -59,8 +49,6 @@ test1()
 
 	tst_res TINFO "verify key measurement for keyrings and templates specified in IMA policy"
 
-	check_policy_template || return
-
 	check_keys_policy "$pattern" > $tmp_file || return
 	keycheck_lines=$(cat $tmp_file)
 	keyrings=$(for i in $keycheck_lines; do echo "$i" | grep "keyrings" | \
@@ -104,9 +92,7 @@ test1()
 # that the certificate is measured correctly by IMA.
 test2()
 {
-	tst_require_cmds keyctl openssl
-
-	require_evmctl "1.3.2"
+	tst_require_cmds evmctl keyctl openssl
 
 	local cert_file="$TST_DATAROOT/x509_ima.der"
 	local keyring_name="key_import_test"
@@ -115,8 +101,6 @@ test2()
 
 	tst_res TINFO "verify measurement of certificate imported into a keyring"
 
-	check_policy_template || return
-
 	check_keys_policy "$pattern" >/dev/null || return
 
 	KEYRING_ID=$(keyctl newring $keyring_name @s) || \

+ 56 - 6
ltp/testcases/bin/ima_measurements.sh

@@ -6,7 +6,7 @@
 #
 # Verify that measurements are added to the measurement list based on policy.
 
-TST_NEEDS_CMDS="awk cut sed"
+TST_NEEDS_CMDS="awk cut"
 TST_SETUP="setup"
 TST_CNT=3
 TST_NEEDS_DEVICE=1
@@ -20,22 +20,72 @@ setup()
 	TEST_FILE="$PWD/test.txt"
 	POLICY="$IMA_DIR/policy"
 	[ -f "$POLICY" ] || tst_res TINFO "not using default policy"
+	DIGEST_INDEX=
+
+	local template="$(tail -1 $ASCII_MEASUREMENTS | cut -d' ' -f 3)"
+	local i
+
+	# parse digest index
+	# https://www.kernel.org/doc/html/latest/security/IMA-templates.html#use
+	case "$template" in
+	ima|ima-ng|ima-sig|ima-buf) DIGEST_INDEX=4 ;;
+	*)
+		# using ima_template_fmt kernel parameter
+		local IFS="|"
+		i=4
+		for word in $template; do
+			if [ "$word" = 'd' -o "$word" = 'd-ng' ]; then
+				DIGEST_INDEX=$i
+				break
+			fi
+			i=$((i+1))
+		done
+	esac
+
+	[ -z "$DIGEST_INDEX" ] && tst_brk TCONF \
+		"Cannot find digest index (template: '$template')"
 }
 
 ima_check()
 {
-	local algorithm digest expected_digest line tmp
+	local delimiter=':'
+	local algorithm digest expected_digest line
 
 	# need to read file to get updated $ASCII_MEASUREMENTS
 	cat $TEST_FILE > /dev/null
 
 	line="$(grep $TEST_FILE $ASCII_MEASUREMENTS | tail -1)"
+	if [ -z "$line" ]; then
+		tst_res TFAIL "cannot find measurement record for '$TEST_FILE'"
+		return
+	fi
+	tst_res TINFO "measurement record: '$line'"
 
-	if tmp=$(get_algorithm_digest "$line"); then
-		algorithm=$(echo "$tmp" | cut -d'|' -f1)
-		digest=$(echo "$tmp" | cut -d'|' -f2)
+	digest=$(echo "$line" | cut -d' ' -f $DIGEST_INDEX)
+	if [ -z "$digest" ]; then
+		tst_res TFAIL "cannot find digest (index: $DIGEST_INDEX)"
+		return
+	fi
+
+	if [ "${digest#*$delimiter}" != "$digest" ]; then
+		algorithm=$(echo "$digest" | cut -d $delimiter -f 1)
+		digest=$(echo "$digest" | cut -d $delimiter -f 2)
 	else
-		tst_res TBROK "failed to get algorithm/digest for '$TEST_FILE': $tmp"
+		case "${#digest}" in
+		32) algorithm="md5" ;;
+		40) algorithm="sha1" ;;
+		*)
+			tst_res TFAIL "algorithm must be either md5 or sha1 (digest: '$digest')"
+			return ;;
+		esac
+	fi
+	if [ -z "$algorithm" ]; then
+		tst_res TFAIL "cannot find algorithm"
+		return
+	fi
+	if [ -z "$digest" ]; then
+		tst_res TFAIL "cannot find digest"
+		return
 	fi
 
 	tst_res TINFO "computing digest for $algorithm algorithm"

+ 4 - 125
ltp/testcases/bin/ima_setup.sh

@@ -93,7 +93,7 @@ require_ima_policy_content()
 	fi
 }
 
-check_ima_policy_cmdline()
+require_ima_policy_cmdline()
 {
 	local policy="$1"
 	local i
@@ -101,18 +101,10 @@ check_ima_policy_cmdline()
 	grep -q "ima_$policy" /proc/cmdline && return
 	for i in $(cat /proc/cmdline); do
 		if echo "$i" | grep -q '^ima_policy='; then
-			echo "$i" | grep -q -e "|[ ]*$policy" -e "$policy[ ]*|" -e "=$policy" && return 0
+			echo "$i" | grep -q -e "|[ ]*$policy" -e "$policy[ ]*|" -e "=$policy" && return
 		fi
 	done
-	return 1
-}
-
-require_ima_policy_cmdline()
-{
-	local policy="$1"
-
-	check_ima_policy_cmdline $policy || \
-		tst_brk TCONF "IMA measurement tests require builtin IMA $policy policy (e.g. ima_policy=$policy kernel parameter)"
+	tst_brk TCONF "IMA measurement tests require builtin IMA $policy policy (e.g. ima_policy=$policy kernel parameter)"
 }
 
 mount_helper()
@@ -145,7 +137,7 @@ mount_loop_device()
 
 print_ima_config()
 {
-	local config="${KCONFIG_PATH:-/boot/config-$(uname -r)}"
+	local config="/boot/config-$(uname -r)"
 	local i
 
 	if [ -r "$config" ]; then
@@ -199,119 +191,6 @@ ima_cleanup()
 	fi
 }
 
-set_digest_index()
-{
-	DIGEST_INDEX=
-
-	local template="$(tail -1 $ASCII_MEASUREMENTS | cut -d' ' -f 3)"
-	local i word
-
-	# parse digest index
-	# https://www.kernel.org/doc/html/latest/security/IMA-templates.html#use
-	case "$template" in
-	ima|ima-ng|ima-sig) DIGEST_INDEX=4 ;;
-	*)
-		# using ima_template_fmt kernel parameter
-		local IFS="|"
-		i=4
-		for word in $template; do
-			if [ "$word" = 'd' -o "$word" = 'd-ng' ]; then
-				DIGEST_INDEX=$i
-				break
-			fi
-			i=$((i+1))
-		done
-	esac
-
-	[ -z "$DIGEST_INDEX" ] && tst_brk TCONF \
-		"Cannot find digest index (template: '$template')"
-}
-
-get_algorithm_digest()
-{
-	local line="$1"
-	local delimiter=':'
-	local algorithm digest
-
-	if [ -z "$line" ]; then
-		echo "measurement record not found"
-		return 1
-	fi
-
-	[ -z "$DIGEST_INDEX" ] && set_digest_index
-	digest=$(echo "$line" | cut -d' ' -f $DIGEST_INDEX)
-	if [ -z "$digest" ]; then
-		echo "digest not found (index: $DIGEST_INDEX, line: '$line')"
-		return 1
-	fi
-
-	if [ "${digest#*$delimiter}" != "$digest" ]; then
-		algorithm=$(echo "$digest" | cut -d $delimiter -f 1)
-		digest=$(echo "$digest" | cut -d $delimiter -f 2)
-	else
-		case "${#digest}" in
-		32) algorithm="md5" ;;
-		40) algorithm="sha1" ;;
-		*)
-			echo "algorithm must be either md5 or sha1 (digest: '$digest')"
-			return 1 ;;
-		esac
-	fi
-	if [ -z "$algorithm" ]; then
-		echo "algorithm not found"
-		return 1
-	fi
-	if [ -z "$digest" ]; then
-		echo "digest not found"
-		return 1
-	fi
-
-	echo "$algorithm|$digest"
-}
-
-# check_evmctl REQUIRED_TPM_VERSION
-# return: 0: evmctl is new enough, 1: version older than required (or version < v0.9)
-check_evmctl()
-{
-	local required="$1"
-
-	local r1="$(echo $required | cut -d. -f1)"
-	local r2="$(echo $required | cut -d. -f2)"
-	local r3="$(echo $required | cut -d. -f3)"
-	[ -z "$r3" ] && r3=0
-
-	tst_is_int "$r1" || tst_brk TBROK "required major version not int ($v1)"
-	tst_is_int "$r2" || tst_brk TBROK "required minor version not int ($v2)"
-	tst_is_int "$r3" || tst_brk TBROK "required patch version not int ($v3)"
-
-	tst_check_cmds evmctl || return 1
-
-	local v="$(evmctl --version | cut -d' ' -f2)"
-	[ -z "$v" ] && return 1
-	tst_res TINFO "evmctl version: $v"
-
-	local v1="$(echo $v | cut -d. -f1)"
-	local v2="$(echo $v | cut -d. -f2)"
-	local v3="$(echo $v | cut -d. -f3)"
-	[ -z "$v3" ] && v3=0
-
-	if [ $v1 -lt $r1 ] || [ $v1 -eq $r1 -a $v2 -lt $r2 ] || \
-		[ $v1 -eq $r1 -a $v2 -eq $r2 -a $v3 -lt $r3 ]; then
-		return 1
-	fi
-	return 0
-}
-
-# require_evmctl REQUIRED_TPM_VERSION
-require_evmctl()
-{
-	local required="$1"
-
-	if ! check_evmctl $required; then
-		tst_brk TCONF "evmctl >= $required required"
-	fi
-}
-
 # loop device is needed to use only for tmpfs
 TMPDIR="${TMPDIR:-/tmp}"
 if [ "$(df -T $TMPDIR | tail -1 | awk '{print $2}')" != "tmpfs" -a -n "$TST_NEEDS_DEVICE" ]; then

+ 57 - 249
ltp/testcases/bin/ima_tpm.sh

@@ -7,284 +7,92 @@
 # Verify the boot and PCR aggregates.
 
 TST_CNT=2
-TST_NEEDS_CMDS="awk cut tail"
-TST_SETUP="setup"
+TST_NEEDS_CMDS="awk cut ima_boot_aggregate"
 
 . ima_setup.sh
 
-EVMCTL_REQUIRED='1.3.1'
-ERRMSG_EVMCTL="=> install evmctl >= $EVMCTL_REQUIRED"
-ERRMSG_TPM="TPM hardware support not enabled in kernel or no TPM chip found"
-
-setup()
-{
-	local config="${KCONFIG_PATH:-/boot/config-$(uname -r)}"
-	local line tmp
-
-	read line < $ASCII_MEASUREMENTS
-	if tmp=$(get_algorithm_digest "$line"); then
-		ALGORITHM=$(echo "$tmp" | cut -d'|' -f1)
-		DIGEST=$(echo "$tmp" | cut -d'|' -f2)
-	else
-		tst_brk TBROK "failed to get algorithm/digest: $tmp"
-	fi
-	tst_res TINFO "used algorithm: $ALGORITHM"
-
-	TPM_VERSION="$(get_tpm_version)"
-	if [ -z "$TPM_VERSION" ]; then
-		tst_res TINFO "$ERRMSG_TPM, testing TPM-bypass"
-	else
-		tst_res TINFO "TPM major version: $TPM_VERSION"
-	fi
-
-	if ! check_evmctl $EVMCTL_REQUIRED; then
-		if [ "$ALGORITHM" != "sha1" ]; then
-			tst_brk TCONF "algorithm not sha1 ($ALGORITHM) $ERRMSG_EVMCTL"
-		fi
-		MISSING_EVMCTL=1
-	fi
-
-	if [ -r "$config" ]; then
-		tst_res TINFO "TPM kernel config:"
-		for i in $(grep -e ^CONFIG_.*_TPM -e ^CONFIG_TCG $config); do
-			tst_res TINFO "$i"
-		done
-	fi
-}
-
-# prints major version: 1: TPM 1.2, 2: TPM 2.0
-# or nothing on TPM-bypass (no TPM device)
-# WARNING: Detecting TPM 2.0 can fail due kernel not exporting TPM 2.0 files.
-get_tpm_version()
+test1()
 {
-	if [ -f /sys/class/tpm/tpm0/tpm_version_major ]; then
-		cat /sys/class/tpm/tpm0/tpm_version_major
-		return
-	fi
+	tst_res TINFO "verify boot aggregate"
 
-	if [ -f /sys/class/tpm/tpm0/device/caps -o \
-		-f /sys/class/misc/tpm0/device/caps ]; then
-		echo 1
-		return
-	fi
+	local zero="0000000000000000000000000000000000000000"
+	local tpm_bios="$SECURITYFS/tpm0/binary_bios_measurements"
+	local ima_measurements="$ASCII_MEASUREMENTS"
+	local boot_aggregate boot_hash line
 
-	if [ -c /dev/tpmrm0 -a -c /dev/tpm0 ]; then
-		echo 2
-		return
-	fi
+	# IMA boot aggregate
+	read line < $ima_measurements
+	boot_hash=$(echo $line | awk '{print $(NF-1)}' | cut -d':' -f2)
 
-	if [ ! -d /sys/class/tpm/tpm0/ -a ! -d /sys/class/misc/tpm0/ ]; then
-		return
-	fi
+	if [ ! -f "$tpm_bios" ]; then
+		tst_res TINFO "TPM Hardware Support not enabled in kernel or no TPM chip found"
 
-	tst_require_cmds dmesg
-	if dmesg | grep -q 'activating TPM-bypass'; then
-		return
-	elif dmesg | grep -q '1\.2 TPM (device-id'; then
-		echo 1
-		return
-	elif dmesg | grep -q '2\.0 TPM (device-id'; then
-		echo 2
-		return
+		if [ "$boot_hash" = "$zero" ]; then
+			tst_res TPASS "bios boot aggregate is 0"
+		else
+			tst_res TFAIL "bios boot aggregate is not 0"
+		fi
+	else
+		boot_aggregate=$(ima_boot_aggregate $tpm_bios | grep "boot_aggregate:" | cut -d':' -f2)
+		if [ "$boot_hash" = "$boot_aggregate" ]; then
+			tst_res TPASS "bios aggregate matches IMA boot aggregate"
+		else
+			tst_res TFAIL "bios aggregate does not match IMA boot aggregate"
+		fi
 	fi
 }
 
-read_pcr_tpm1()
+# Probably cleaner to programmatically read the PCR values directly
+# from the TPM, but that would require a TPM library. For now, use
+# the PCR values from /sys/devices.
+validate_pcr()
 {
-	local pcrs_path="/sys/class/tpm/tpm0/device/pcrs"
-	local evmctl_required="1.1"
-	local hash pcr
+	tst_res TINFO "verify PCR (Process Control Register)"
 
-	if [ ! -f "$pcrs_path" ]; then
-		pcrs_path="/sys/class/misc/tpm0/device/pcrs"
-	elif ! check_evmctl $evmctl_required; then
-		echo "evmctl >= $evmctl_required required"
-		return 32
-	fi
+	local dev_pcrs="$1"
+	local pcr hash aggregate_pcr
 
-	if [ ! -f "$pcrs_path" ]; then
-		echo "missing PCR file $pcrs_path ($ERRMSG_TPM)"
-		return 32
+	aggregate_pcr="$(evmctl -v ima_measurement $BINARY_MEASUREMENTS 2>&1 | \
+		grep 'HW PCR-10:' | awk '{print $3}')"
+	if [ -z "$aggregate_pcr" ]; then
+		tst_res TFAIL "failed to get PCR-10"
+		return 1
 	fi
 
 	while read line; do
 		pcr="$(echo $line | cut -d':' -f1)"
-		hash="$(echo $line | cut -d':' -f2 | awk '{ gsub (" ", "", $0); print tolower($0) }')"
-		echo "$pcr: $hash"
-	done < $pcrs_path
-
-	return 0
-}
-
-# NOTE: TPM 1.2 would require to use tss1pcrread which is not fully adopted
-# by distros yet.
-read_pcr_tpm2()
-{
-	local pcrmax=23
-	local pcrread="tsspcrread -halg $ALGORITHM"
-	local i pcr
-
-	if ! tst_cmd_available tsspcrread; then
-		echo "tsspcrread not found"
-		return 32
-	fi
-
-	for i in $(seq 0 $pcrmax); do
-		pcr=$($pcrread -ha "$i" -ns)
-		if [ $? -ne 0 ]; then
-			echo "tsspcrread failed: $pcr"
-			return 1
+		if [ "$pcr" = "PCR-10" ]; then
+			hash="$(echo $line | cut -d':' -f2 | awk '{ gsub (" ", "", $0); print tolower($0) }')"
+			[ "$hash" = "$aggregate_pcr" ]
+			return $?
 		fi
-		printf "PCR-%02d: %s\n" $i "$pcr"
-	done
-
-	return 0
-}
-
-get_pcr10_aggregate()
-{
-	local cmd="evmctl -vv ima_measurement $BINARY_MEASUREMENTS"
-	local msg="$ERRMSG_EVMCTL"
-	local res=TCONF
-	local pcr ret
-
-	if [ -z "$MISSING_EVMCTL" ]; then
-		msg=
-		res=TFAIL
-	fi
-
-	$cmd > hash.txt 2>&1
-	ret=$?
-	if [ $ret -ne 0 -a -z "$MISSING_EVMCTL" ]; then
-		tst_res TFAIL "evmctl failed, trying with --ignore-violations"
-		cmd="$cmd --ignore-violations"
-		$cmd > hash.txt 2>&1
-		ret=$?
-	elif [ $ret -ne 0 -a "$MISSING_EVMCTL" = 1 ]; then
-		tst_brk TFAIL "evmctl failed $msg"
-	fi
-
-	[ $ret -ne 0 ] && tst_res TWARN "evmctl failed, trying to continue $msg"
-
-	pcr=$(grep -E "^($ALGORITHM: )*PCRAgg(.*10)*:" hash.txt | tail -1 \
-		| awk '{print $NF}')
-
-	if [ -z "$pcr" ]; then
-		tst_res $res "failed to find aggregate PCR-10 $msg"
-		tst_res TINFO "hash file:"
-		cat hash.txt >&2
-		return
-	fi
-
-	echo "$pcr"
-}
-
-test1_tpm_bypass_mode()
-{
-	local zero=$(echo $DIGEST | awk '{gsub(/./, "0")}; {print}')
-
-	if [ "$DIGEST" = "$zero" ]; then
-		tst_res TPASS "bios boot aggregate is $zero"
-	else
-		tst_res TFAIL "bios boot aggregate is not $zero ($DIGEST), kernel didn't export TPM 2.0 files for TPM device?"
-		return 1
-	fi
-}
-
-test1_hw_tpm()
-{
-	local tpm_bios="$SECURITYFS/tpm0/binary_bios_measurements"
-	local cmd="evmctl ima_boot_aggregate -v"
-	local boot_aggregate
-
-	if [ -z "$TPM_VERSION" ]; then
-		tst_res TWARN "TPM-bypass failed, trying to test TPM device (unknown TPM version)"
-		MAYBE_TPM2=1
-	fi
-
-	if [ "$MISSING_EVMCTL" = 1 ]; then
-		if [ ! -f "$tpm_bios" ]; then
-			tst_res TCONF "missing $tpm_bios $ERRMSG_EVMCTL"
-			return
-		fi
-		tst_check_cmds ima_boot_aggregate || return
-		cmd="ima_boot_aggregate -f $tpm_bios"
-	fi
-	tst_res TINFO "using command: $cmd"
-
-	boot_aggregate=$($cmd | grep "$ALGORITHM:" | cut -d':' -f2)
-	if [ -z "$boot_aggregate" ]; then
-		tst_res TFAIL "failed to get boot aggregate"
-		return
-	fi
-	tst_res TINFO "IMA boot aggregate: '$boot_aggregate'"
-
-	if [ "$DIGEST" = "$boot_aggregate" ]; then
-		tst_res TPASS "bios boot aggregate matches IMA boot aggregate"
-	else
-		tst_res TFAIL "bios boot aggregate does not match IMA boot aggregate ($DIGEST)"
-	fi
-}
-
-test1()
-{
-	tst_res TINFO "verify boot aggregate"
-
-	# deliberately try test1_hw_tpm() if test1_tpm_bypass_mode() fails
-	[ -z "$TPM_VERSION" ] && test1_tpm_bypass_mode || test1_hw_tpm
+	done < $dev_pcrs
+	return 1
 }
 
 test2()
 {
-	local hash pcr_aggregate out ret
-
 	tst_res TINFO "verify PCR values"
+	tst_check_cmds evmctl || return
 
-	if [ "$MAYBE_TPM2" = 1 ]; then
-		tst_res TINFO "TPM version not detected ($ERRMSG_TPM), assume TPM 2"
-		TPM_VERSION=2
-	fi
-
-	if [ -z "$TPM_VERSION" ]; then
-		tst_brk TCONF "TPM version not detected ($ERRMSG_TPM)"
-	fi
-
-	if [ "$ALGORITHM" = "sha1" -a "$MISSING_EVMCTL" = 1 ]; then
-		tst_check_cmds evmctl || return 1
-	fi
+	tst_res TINFO "evmctl version: $(evmctl --version)"
 
-	out=$(read_pcr_tpm$TPM_VERSION)
-	ret=$?
-
-	if [ $ret -ne 0 ]; then
-		case "$ret" in
-			1) tst_res TFAIL "$out";;
-			32) tst_res TCONF "$out";;
-			*) tst_brk TBROK "unsupported return type '$1'";;
-		esac
-		return
-	fi
-
-	hash=$(echo "$out" | grep "^PCR-10" | cut -d' ' -f2)
-
-	if [ -z "$out" ]; then
-		tst_res TFAIL "PCR-10 hash not found"
-		return
-	fi
-
-	tst_res TINFO "real PCR-10: '$hash'"
-
-	get_pcr10_aggregate > tmp.txt
-	pcr_aggregate="$(cat tmp.txt)"
-	if [ -z "$pcr_aggregate" ]; then
-		return
+	local pcrs_path="/sys/class/tpm/tpm0/device/pcrs"
+	if [ -f "$pcrs_path" ]; then
+		tst_res TINFO "new PCRS path, evmctl >= 1.1 required"
+	else
+		pcrs_path="/sys/class/misc/tpm0/device/pcrs"
 	fi
-	tst_res TINFO "aggregate PCR-10: '$pcr_aggregate'"
 
-	if [ "$hash" = "$pcr_aggregate" ]; then
-		tst_res TPASS "aggregate PCR value matches real PCR value"
+	if [ -f "$pcrs_path" ]; then
+		validate_pcr $pcrs_path
+		if [ $? -eq 0 ]; then
+			tst_res TPASS "aggregate PCR value matches real PCR value"
+		else
+			tst_res TFAIL "aggregate PCR value does not match real PCR value"
+		fi
 	else
-		tst_res TFAIL "aggregate PCR value does not match real PCR value"
+		tst_res TCONF "TPM Hardware Support not enabled in kernel or no TPM chip found"
 	fi
 }
 

+ 4 - 5
ltp/testcases/bin/ip_tests.sh

@@ -13,7 +13,6 @@ TST_CLEANUP="cleanup"
 TST_NEEDS_TMPDIR=1
 TST_NEEDS_ROOT=1
 TST_NEEDS_CMDS="cat awk diff"
-TST_NEEDS_DRIVERS="dummy"
 
 . tst_net.sh
 
@@ -26,10 +25,10 @@ init()
 	iface=ltp_dummy
 	lsmod | grep -q dummy || rm_dummy=1
 
-	ROD ip link add $iface type dummy
+	ROD ip li add $iface type dummy
 
 	ip4_addr=${IPV4_NET16_UNUSED}.6.6
-	ROD ip addr add ${ip4_addr}/24 dev $iface
+	ROD ip a add ${ip4_addr}/24 dev $iface
 
 	cat > tst_ip02.exp <<-EOF
 	1:
@@ -47,12 +46,12 @@ init()
 
 cleanup()
 {
-	[ -n "$iface" -a -d /sys/class/net/$iface ] && ip link del $iface
+	[ -n "$iface" -a -d /sys/class/net/$iface ] && ip li del $iface
 
 	[ "$rm_dummy" ] && modprobe -r dummy
 
 	# test #5
-	[ "$ip4_addr" ] && ip route show | grep -q $ip4_addr && ip route del $ip4_addr
+	ip route show | grep $ip4_addr && ip route del $ip4_addr
 }
 
 test1()

+ 1 - 1
ltp/testcases/bin/ipsec_lib.sh

@@ -83,7 +83,7 @@ ipsec_lib_setup()
 	ALGR=
 
 	if [ -n "$IPSEC_MODE" ]; then
-		tst_net_run -q "tst_check_drivers xfrm_user" || \
+		tst_net_run "tst_check_drivers xfrm_user" || \
 			tst_brk TCONF "xfrm_user driver not available on lhost or rhost"
 		cleanup_xfrm=1
 	fi

+ 1 - 3
ltp/testcases/bin/lsmod01.sh

@@ -44,9 +44,7 @@ cleanup()
 
 lsmod_matches_proc_modules()
 {
-	lsmod_output=$(lsmod \
-			| awk '!/Module/{print $1, $2, ($3==-2) ? "-" : $3}' \
-			| sort)
+	lsmod_output=$(lsmod | awk '!/Module/{print $1, $2, $3}' | sort)
 	if [ -z "$lsmod_output" ]; then
 		tst_brk TBROK "Failed to parse the output from lsmod"
 	fi

+ 41 - 0
ltp/testcases/bin/mcast-group-multiple-socket

@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines  Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+	# Increase the maximum number of open file descriptors
+	if [ $(ulimit -n) -lt $MCASTNUM_HEAVY ]; then
+		ulimit -n $MCASTNUM_HEAVY || tst_brk TCONF \
+			"Failed to set the maximum number of open file descriptors to $MCASTNUM_HEAVY"
+	fi
+
+	mcast_setup $MCASTNUM_HEAVY
+}
+
+do_test()
+{
+	tst_res TINFO "joining $MCASTNUM_HEAVY IPv$TST_IPVER multicast groups on multiple sockets"
+	do_multicast_test_multiple_join $MCASTNUM_HEAVY true
+}
+
+tst_run

+ 35 - 0
ltp/testcases/bin/mcast-group-same-group

@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines  Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
+	do_multicast_test_join_leave $MCASTNUM_NORMAL
+}
+
+tst_run

+ 35 - 0
ltp/testcases/bin/mcast-group-single-socket

@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines  Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_HEAVY
+}
+
+do_test()
+{
+	tst_res TINFO "joining $MCASTNUM_HEAVY IPv$TST_IPVER multicast groups on a single socket"
+	do_multicast_test_multiple_join $MCASTNUM_HEAVY
+}
+
+tst_run

+ 35 - 0
ltp/testcases/bin/mcast-group-source-filter

@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) International Business Machines  Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Setup: testcases/network/stress/README
+#
+# Author: Mitsuru Chinen <mitch@jp.ibm.com>
+
+. mcast-lib.sh
+
+do_setup()
+{
+	mcast_setup $MCASTNUM_NORMAL
+}
+
+do_test()
+{
+	tst_res TINFO "joining and leaving the same IPv$TST_IPVER multicast group with a different source filters on $MCASTNUM_NORMAL sockets in $NS_TIMES times"
+	do_multicast_test_join_leave $MCASTNUM_NORMAL true
+}
+
+tst_run

+ 5 - 29
ltp/testcases/bin/mcast-lib.sh

@@ -1,11 +1,15 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2017-2021 Petr Vorel <pvorel@suse.cz>
+# Copyright (c) 2017-2018 Petr Vorel <pvorel@suse.cz>
 # Copyright (c) International Business Machines Corp., 2006
 # Author: Petr Vorel <pvorel@suse.cz>
 #
 # Setup script for multicast stress tests.
 
+TST_SETUP="do_setup"
+TST_CLEANUP="mcast_cleanup"
+TST_TESTFUNC="do_test"
+TST_NEEDS_TMPDIR=1
 . tst_net_stress.sh
 
 mcast_setup4()
@@ -55,18 +59,6 @@ mcast_setup()
 	[ "$TST_IPV6" ] && mcast_setup6 || mcast_setup4 $max
 }
 
-mcast_setup_normal()
-{
-	mcast_setup $MCASTNUM_NORMAL
-}
-
-mcast_setup_normal_udp()
-{
-	mcast_setup_normal
-	MCAST_LCMD="ns-mcast_receiver"
-	MCAST_RCMD="ns-udpsender"
-}
-
 mcast_cleanup4()
 {
 	[ -n "$SYSFS_IGMP_MAX_MEMBERSHIPS" ] && sysctl -q -w net.ipv4.igmp_max_memberships=$SYSFS_IGMP_MAX_MEMBERSHIPS
@@ -148,19 +140,3 @@ do_multicast_test_join_leave()
 
 	tst_res TPASS "test is finished successfully"
 }
-
-do_multicast_test_join_single_socket()
-{
-	local extra="$1"
-	local prefix="$MCAST_IPV4_ADDR_PREFIX"
-	[ "$TST_IPV6" ] && prefix="$MCAST_IPV6_ADDR_PREFIX"
-
-	# Run a multicast join tool
-	local tmpfile=$$
-	EXPECT_PASS $MCAST_LCMD -n 1 -p $prefix \> $tmpfile
-	tst_res TINFO "joined $(grep groups $tmpfile)"
-
-	local params
-	[ "$TST_IPV6" ] && params="-S $(tst_ipaddr) -m"
-	EXPECT_RHOST_PASS $MCAST_RCMD -t $NS_DURATION -r 0 $params $extra
-}

+ 207 - 0
ltp/testcases/bin/mcast4-pktfld01

@@ -0,0 +1,207 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-pktfld01
+#
+# Description:
+#   Verify that the kernel is not crashed when joining a IPv4 multicast group
+#   a single socket, then receiving a large number of UDP packets at the socket
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-pktfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}      # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Multicast Address
+MCAST_ADDR=224.10.0.1
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # Unset the maximum number of processes
+    ulimit -u unlimited
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining a IPv4 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
+
+do_setup
+
+# Find the available consecutive ports
+mcast_port=`find_portbundle udp 1025 1`
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "No port is available."
+    exit 1
+fi
+
+# Run a receiver
+ns-mcast_receiver -f 4 -I $lhost_ifname -m $MCAST_ADDR -p $mcast_port -b
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast receiver"
+    exit 1
+fi
+
+# Run a sender
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $MCAST_ADDR -f 4 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast sender"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0

+ 225 - 0
ltp/testcases/bin/mcast4-pktfld02

@@ -0,0 +1,225 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-pktfld02
+#
+# Description:
+#   Verify that the kernel is not crashed when joining plural IPv4 multicast
+#   groups on separate sockets, then receiving a large number of UDP packets at
+#   the each socket
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-pktfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}      # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the multicast address
+MCAST_ADDR_PREFIX=224.10
+
+# Number of the multicast connection
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # Unset the maximum number of processes
+    ulimit -u unlimited
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=$MCASTNUM_NORMAL >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
+
+# Make sure the value of LTPROOT
+do_setup
+
+mcastnum=0
+mcast_port_range=`find_portbundle udp 1025 $MCASTNUM_NORMAL`
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to get enough port"
+    exit 1
+fi
+mcast_port_top=`echo $mcast_port_range | cut -f 1 -d '-'`
+
+while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
+    # Define the multicast address
+    x=`expr $mcastnum \/ 254`
+    y=`expr $mcastnum % 254 + 1`
+    if [ $x -gt 254 ]; then
+	tst_resm TINFO "The number of the connection is less than $mcastnum"
+	break
+    fi
+    mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+    # Run a receiver
+    mcast_port=`expr $mcast_port_top + $mcastnum`
+    ns-mcast_receiver -f 4 -I $lhost_ifname -m $mcast_addr -p $mcast_port -b
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to start multicast receiver"
+	exit 1
+    fi
+
+    # Run a sender
+    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $mcast_addr -f 4 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION
+
+    mcastnum=`expr $mcastnum + 1`
+done
+
+sleep $NS_DURATION
+do_cleanup
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0

+ 199 - 0
ltp/testcases/bin/mcast4-queryfld01

@@ -0,0 +1,199 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-queryfld01
+#
+# Description:
+#   Verify that the kernel is not crashed when joining an IPv4 multicast group
+#   on a single socket, then receiving a large number of General Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send IGMP General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start IGMP querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 202 - 0
ltp/testcases/bin/mcast4-queryfld02

@@ -0,0 +1,202 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-queryfld02
+#
+# Description:
+#   Verify that the kernel is not crashed when joining an IPv4 multicast group
+#   on a single socket, then receiving a large number of Multicast Address
+#   Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+# Multicast Address
+MCAST_ADDR=224.10.0.1	# If you modify this, please refer ns-mcast_join.c
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send IGMP Multicast Address Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start IGMP querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 208 - 0
ltp/testcases/bin/mcast4-queryfld03

@@ -0,0 +1,208 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-queryfld03
+#
+# Description:
+#   Verify that the kernel is not crashed when joining an IPv4 multicast group
+#   on a single socket, then receiving a large number of Multicast Address
+#   and Source Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld03
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+# Multicast Address
+MCAST_ADDR=224.10.0.1	# If you modify this, please refer ns-mcast_join.c
+
+# Source Address
+SRC_ADDR=10.10.10.1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv4 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send IGMP Multicast Address and Source Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $MCAST_ADDR -s $SRC_ADDR -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start IGMP querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 202 - 0
ltp/testcases/bin/mcast4-queryfld04

@@ -0,0 +1,202 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-queryfld04
+#
+# Description:
+#   Verify that the kernel is not crashed when joining plural IPv4 multicast
+#   groups on separate socket, then receiving a large number of General Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld04
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send IGMP General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -t $NS_DURATION -r 0' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start IGMP querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 213 - 0
ltp/testcases/bin/mcast4-queryfld05

@@ -0,0 +1,213 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-queryfld05
+#
+# Description:
+#   Verify that the kernel is not crashed when joining joining plural IPv4
+#   multicast groups on separate socket, then receiving a large number of
+#   Multicast Address Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld05
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send IGMP Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+    # Define the multicast address
+    x=`expr $querier_num \/ 254`
+    y=`expr $querier_num % 254 + 1`
+    if [ $x -gt 254 ]; then
+	tst_resm TINFO "The number of the connection is less than $querier_num"
+	break
+    fi
+    mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $mcast_addr -t $NS_DURATION -r 0 -b
+
+    querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 219 - 0
ltp/testcases/bin/mcast4-queryfld06

@@ -0,0 +1,219 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast4-queryfld06
+#
+# Description:
+#   Verify that the kernel is not crashed when joining joining plural IPv4
+#   multicast groups on separate socket, then receiving a large number of
+#   Multicast Address and Source Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast4-queryfld06
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv4 address
+NETWORK_PART=${IPV4_NETWORK:-"10.0.0"}
+
+# Netmask of the IPv4 network
+NETWORK_MASK=24
+
+# Host portion of the IPv4 address
+LHOST_HOST_PART=${LHOST_IPV4_HOST:-"2"}     # local host
+RHOST_HOST_PART=${RHOST_IPV4_HOST:-"1"}     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=224.10
+
+# Source Address
+SRC_ADDR=10.10.10.1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-igmp_querier >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv4 addresses to the interfaces
+    set_ipv4addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    set_ipv4addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv4 address of the local/remote host
+    lhost_addr="${NETWORK_PART}.${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}.${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv4_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv4 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv4.igmp_max_memberships=20 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv4.igmp_max_msf=10 >/dev/null
+    sysctl -w net.ipv4.conf.${lhost_ifname}.force_igmp_version=0 >/dev/null
+    sysctl -w net.ipv4.conf.all.force_igmp_version=0 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv4 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 4 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send IGMP Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+    # Define the multicast address
+    x=`expr $querier_num \/ 254`
+    y=`expr $querier_num % 254 + 1`
+    if [ $x -gt 254 ]; then
+	tst_resm TINFO "The number of the connection is less than $querier_num"
+	break
+    fi
+    mcast_addr=${MCAST_ADDR_PREFIX}.${x}.${y}
+
+    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-igmp_querier -I $rhost_ifname -m $mcast_addr -s $SRC_ADDR -t $NS_DURATION -r 0 -b
+
+    querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 203 - 0
ltp/testcases/bin/mcast6-pktfld01

@@ -0,0 +1,203 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-pktfld01
+#
+# Description:
+#   Verify that the kernel is not crashed when joining a IPv6 multicast group
+#   a single socket, then receiving a large number of UDP packets at the socket
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 6 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-pktfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}      # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"     # local host
+RHOST_HOST_PART=":1"     # remote host
+
+# Multicast Address
+MCAST_ADDR=ff0e::1111:1
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # Unset the maximum number of processes
+    ulimit -u unlimited
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining a IPv6 multicast group a single socket, then receiving a large number of UDP packets at the socket in $NS_DURATION [sec]"
+
+do_setup
+
+# Find the available consecutive ports
+mcast_port=`find_portbundle udp 1025 1`
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "No port is available."
+    exit 1
+fi
+
+# Run a receiver
+ns-mcast_receiver -f 6 -I $lhost_ifname -m $MCAST_ADDR -p $mcast_port -b
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast receiver"
+    exit 1
+fi
+
+# Run a sender
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $MCAST_ADDR -f 6 -p $mcast_port -s 32767 -m -I $rhost_ifname -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast sender"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0

+ 220 - 0
ltp/testcases/bin/mcast6-pktfld02

@@ -0,0 +1,220 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-pktfld02
+#
+# Description:
+#   Verify that the kernel is not crashed when joining plural IPv6 multicast
+#   groups on separate sockets, then receiving a large number of UDP packets at
+#   the each socket
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-pktfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}      # 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"	# local host
+RHOST_HOST_PART=":1"	# remote host
+
+# Prefix of the multicast address
+MCAST_ADDR_PREFIX=ff0e::1111
+
+# Number of the multicast connection
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_receiver >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-udpsender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # Unset the maximum number of processes
+    ulimit -u unlimited
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of UDP packets at the each socket in $NS_DURATION [sec]"
+
+# Make sure the value of LTPROOT
+do_setup
+
+mcastnum=0
+mcast_port_range=`find_portbundle udp 1025 $MCASTNUM_NORMAL`
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to get enough port"
+    exit 1
+fi
+mcast_port_top=`echo $mcast_port_range | cut -f 1 -d '-'`
+
+while [ $mcastnum -lt $MCASTNUM_NORMAL ]; do
+    # Define the multicast address
+    if [ $mcastnum -gt 65535 ]; then
+	tst_resm TINFO "The number of the connection is less than 65535"
+	break
+    fi
+    mcastnum_hex=`printf "%x" $mcastnum`
+    mcast_addr=${MCAST_ADDR_PREFIX}:${mcastnum_hex}
+
+    # Run a receiver
+    mcast_port=`expr $mcast_port_top + $mcastnum`
+    ns-mcast_receiver -f 6 -I $lhost_ifname -m $mcast_addr -p $mcast_port -b
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to start multicast receiver"
+	exit 1
+    fi
+
+    # Run a sender
+    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-udpsender -D $mcast_addr -f 6 -p $mcast_port -m -I $rhost_ifname -b -t $NS_DURATION
+
+    mcastnum=`expr $mcastnum + 1`
+done
+
+sleep $NS_DURATION
+do_cleanup
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+tst_resm TPASS "Test is finished successfully."
+exit 0

+ 197 - 0
ltp/testcases/bin/mcast6-queryfld01

@@ -0,0 +1,197 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-queryfld01
+#
+# Description:
+#   Verify that the kernel is not crashed when joining an IPv6 multicast
+#   group on a single socket, then receiving a large number of General Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld01
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"	# local host
+RHOST_HOST_PART=":1"	# remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+    rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send MLD General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION' ; echo $?'`
+
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start MLD querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 199 - 0
ltp/testcases/bin/mcast6-queryfld02

@@ -0,0 +1,199 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-queryfld02
+#
+# Description:
+#   Verify that the kernel is not crashed when joining an IPv6 multicast group
+#   on a single socket, then receiving a large number of Multicast Address
+#   Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld02
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"	# local host
+RHOST_HOST_PART=":1"	# remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+# Multicast Address
+MCAST_ADDR=ff0e::1	# If you modify this, please refer ns-mcast_join.c
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+    rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send MLD Multicast Address Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start MLD querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 205 - 0
ltp/testcases/bin/mcast6-queryfld03

@@ -0,0 +1,205 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-queryfld03
+#
+# Description:
+#   Verify that the kernel is not crashed when joining an IPv6 multicast group
+#   on a single socket, then receiving a large number of Multicast Address
+#   and Source Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 1 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld03
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"     # local host
+RHOST_HOST_PART=":1"     # remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+# Multicast Address
+MCAST_ADDR=ff0e::1	# If you modify this, please refer ns-mcast_join.c
+
+# Source Address
+SRC_ADDR=fec0:100:100:100::1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+    rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining an IPv6 multicast group on a single socket, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n 1 -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send MLD Multicast Address and Source Specific Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $MCAST_ADDR -a $SRC_ADDR -r 0 -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start MLD querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 199 - 0
ltp/testcases/bin/mcast6-queryfld04

@@ -0,0 +1,199 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-queryfld04
+#
+# Description:
+#   Verify that the kernel is not crashed when joining plural IPv6 multicast
+#   groups on separate socket, then receiving a large number of General Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld04
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"	# local host
+RHOST_HOST_PART=":1"	# remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+    rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of General Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX >/dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send MLD General Query from the remote host
+ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -r 0 -t $NS_DURATION' ; echo $?'`
+if [ $ret -ne 0 ]; then
+    tst_resm TBROK "Failed to start MLD querier"
+    exit 1
+fi
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 209 - 0
ltp/testcases/bin/mcast6-queryfld05

@@ -0,0 +1,209 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-queryfld05
+#
+# Description:
+#   Verify that the kernel is not crashed when joining joining plural IPv6
+#   multicast groups on separate socket, then receiving a large number of
+#   Multicast Address Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld05
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"	# local host
+RHOST_HOST_PART=":1"	# remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+    rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX > /dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send MLD Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+    # Define the multicast address
+    if [ $querier_num -gt 65535 ]; then
+	tst_resm TINFO "The number of the querier is less than 65535"
+	break
+    fi
+    querier_num_hex=`printf "%x" $querier_num`
+    mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
+
+    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -r 0 -t $NS_DURATION -b
+
+    querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 213 - 0
ltp/testcases/bin/mcast6-queryfld06

@@ -0,0 +1,213 @@
+#!/bin/sh
+
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2006                 ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+##                                                                            ##
+################################################################################
+#
+# File:
+#   mcast6-queryfld06
+#
+# Description:
+#   Verify that the kernel is not crashed when joining joining plural IPv6
+#   multicast groups on separate socket, then receiving a large number of
+#   Multicast Address and Source Specific Query
+#
+# Setup:
+#   See testcases/network/stress/README
+#
+# Author:
+#   Mitsuru Chinen <mitch@jp.ibm.com>
+#
+# History:
+#	May 7 2006 - Created (Mitsuru Chinen)
+#
+#-----------------------------------------------------------------------
+# Uncomment line below for debug output.
+#trace_logic=${trace_logic:-"set -x"}
+$trace_logic
+
+# The test case ID, the test case count and the total number of test case
+TCID=mcast6-queryfld06
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+# Make sure the value of LTPROOT
+LTPROOT=${LTPROOT:-`(cd ../../../../.. ; pwd)`}
+export LTPROOT
+
+# Check the environmanet variable
+. check_envval || exit $TST_TOTAL
+
+# Dulation of the test [sec]
+NS_DURATION=${NS_DURATION:-3600}	# 1 hour
+
+# Number of the multicast to join
+MCASTNUM_NORMAL=${MCASTNUM_NORMAL:-20}
+
+# The number of the test link where tests run
+LINK_NUM=${LINK_NUM:-0}
+
+# Network portion of the IPv6 address
+NETWORK_PART="fec0:1:1:1"
+
+# Host portion of the IPv6 address
+LHOST_HOST_PART=":2"	# local host
+RHOST_HOST_PART=":1"	# remote host
+
+# Prefix of the Multicast Address
+MCAST_ADDR_PREFIX=ff0e:
+
+# Source Address
+SRC_ADDR=fec0:100:100:100::1
+
+# Filter Mode
+FILTER_MODE="include"
+
+#-----------------------------------------------------------------------
+#
+# Function: do_cleanup
+#
+# Description:
+#   Recover the system configuration
+#
+#-----------------------------------------------------------------------
+do_cleanup()
+{
+    # Make sure to kill the multicast receiver and sender
+    killall -SIGHUP ns-mcast_join >/dev/null 2>&1
+    $LTP_RSH $RHOST killall -SIGHUP ns-icmpv6_sender >/dev/null 2>&1
+
+    # Clean up each interface
+    initialize_if lhost ${LINK_NUM}
+    initialize_if rhost ${LINK_NUM}
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Function: do_setup
+#
+# Description:
+#   Configure the ssystem for the test
+#
+#-----------------------------------------------------------------------
+do_setup()
+{
+    # Initialize the system configuration
+    do_cleanup
+
+    # Call do_cleanup function before exit
+    trap do_cleanup 0
+
+    # name of interface of the local/remote host
+    lhost_ifname=`get_ifname lhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the local host"
+	exit $TST_TOTAL
+    fi
+
+    rhost_ifname=`get_ifname rhost $LINK_NUM`
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to get the interface name at the remote host"
+	exit $TST_TOTAL
+    fi
+
+    # Set IPv6 addresses to the interfaces
+    add_ipv6addr lhost $LINK_NUM $NETWORK_PART $LHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the local host"
+	exit 1
+    fi
+
+    add_ipv6addr rhost $LINK_NUM $NETWORK_PART $RHOST_HOST_PART
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to add any IP address at the remote host"
+	exit 1
+    fi
+
+    # IPv6 address of the local/remote host
+    lhost_addr="${NETWORK_PART}:${LHOST_HOST_PART}"
+    rhost_addr="${NETWORK_PART}:${RHOST_HOST_PART}"
+    rhost_linklocal="fe80:${RHOST_HOST_PART}"
+
+    # Make sure the connectvity
+    check_icmpv6_connectivity $lhost_ifname $rhost_addr
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "There is no IPv6 connectivity."
+	exit 1
+    fi
+
+    # Make sure the sysctl values
+    sysctl -w net.ipv6.conf.all.force_mld_version=0 >/dev/null
+    if [ $? -ne 0 ]; then
+	tst_resm TBROK "Failed to set the sysctl value regarding multicast"
+	exit $TST_TOTAL
+    fi
+
+    sysctl -w net.ipv6.conf.${lhost_ifname}.force_mld_version=0 >/dev/null
+    sysctl -w net.ipv6.mld_max_msf=10 >/dev/null
+}
+
+
+#-----------------------------------------------------------------------
+#
+# Main
+#
+#
+
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed when joining $MCASTNUM_NORMAL IPv6 multicast groups on separate sockets, then receiving a large number of Multicast Address and Source Specific Query in $NS_DURATION [sec]"
+
+do_setup
+
+# Run a multicast join tool
+ns-mcast_join -f 6 -I $lhost_ifname -n $MCASTNUM_NORMAL -p $MCAST_ADDR_PREFIX -s $SRC_ADDR -F $FILTER_MODE > /dev/null
+if [ $? -ne 0 ]; then
+    tst_resm TBROK "Failed to start multicast joining tool Please check the environment"
+    exit 1
+fi
+
+# Send MLD Multicast Address Specific Query from the remote host
+querier_num=0
+while [ $querier_num -lt $MCASTNUM_NORMAL ]; do
+    if [ $querier_num -gt 65535 ]; then
+	tst_resm TINFO "The number of the querier is less than 65535"
+	break
+    fi
+    querier_num_hex=`printf "%x" $querier_num`
+    mcast_addr=${MCAST_ADDR_PREFIX}:${querier_num_hex}
+
+    $LTP_RSH $RHOST ${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_linklocal -m -D $mcast_addr -a $SRC_ADDR -r 0 -t $NS_DURATION -b
+    querier_num=`expr $querier_num + 1`
+done
+sleep $NS_DURATION
+
+#-----------------------------------------------------------------------
+#
+# Clean up
+#
+
+do_cleanup
+tst_resm TPASS "Test is finished successfully."
+
+exit 0

+ 49 - 30
ltp/testcases/bin/memcg_failcnt.sh

@@ -1,39 +1,58 @@
 #!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
 
-MEMCG_TESTFUNC=test
-MEMCG_SHMMAX=1
-TST_TEST_DATA="--mmap-anon --mmap-file --shm"
-. memcg_lib.sh
+################################################################################
+##                                                                            ##
+## Copyright (c) 2009 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software Foundation,   ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA           ##
+##                                                                            ##
+## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>                     ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak		      ##
+##						<risrajak@linux.vnet.ibm.com  ##
+##                                                                            ##
+################################################################################
+
+TCID="memcg_failcnt"
+TST_TOTAL=3
 
-MEMORY_LIMIT=$PAGESIZE
-MEMORY_TO_ALLOCATE=$((MEMORY_LIMIT * 2))
+. memcg_lib.sh
 
-test()
+# Test memory.failcnt
+testcase_1()
 {
-	echo $MEMORY_LIMIT > memory.limit_in_bytes
-
-	start_memcg_process $2 -s ${MEMORY_TO_ALLOCATE}
-	echo $MEMCG_PROCESS_PID > tasks
-
-	signal_memcg_process ${MEMORY_TO_ALLOCATE}
-	signal_memcg_process ${MEMORY_TO_ALLOCATE}
+	echo $PAGESIZE > memory.limit_in_bytes
+	malloc_free_memory "--mmap-anon" $(($PAGESIZE*2))
+	test_failcnt "memory.failcnt"
+}
 
-	stop_memcg_process
+testcase_2()
+{
+	echo $PAGESIZE > memory.limit_in_bytes
+	malloc_free_memory "--mmap-file" $(($PAGESIZE*2))
+	test_failcnt "memory.failcnt"
+}
 
-	failcnt=$(cat memory.failcnt)
-	if [ $failcnt -gt 0 ]; then
-		tst_res TPASS "memory.failcnt is $failcnt, > 0 as expected"
-	else
-		tst_res TFAIL "memory.failcnt is $failcnt, <= 0 expected"
-	fi
+testcase_3()
+{
+	echo $PAGESIZE > memory.limit_in_bytes
+	malloc_free_memory "--shm" $(($PAGESIZE*2))
+	test_failcnt "memory.failcnt"
 }
 
-tst_run
+shmmax_setup
+LOCAL_CLEANUP=shmmax_cleanup
+run_tests
+tst_exit

+ 42 - 22
ltp/testcases/bin/memcg_force_empty.sh

@@ -1,25 +1,44 @@
 #!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
-
-MEMCG_TESTFUNC=test
-TST_CNT=6
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2009 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software Foundation,   ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA           ##
+##                                                                            ##
+## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>                     ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak		      ##
+##						<risrajak@linux.vnet.ibm.com  ##
+##                                                                            ##
+################################################################################
+
+TCID="memcg_force_empty"
+TST_TOTAL=6
 
 . memcg_lib.sh
 
 # Test memory.force_empty
-test1()
+testcase_1()
 {
-	start_memcg_process --mmap-anon -s $PAGESIZE
-	echo $MEMCG_PROCESS_PID > tasks
-	signal_memcg_process $PAGESIZE
-	echo $MEMCG_PROCESS_PID > ../tasks
+	memcg_process --mmap-anon -s $PAGESIZE &
+	pid=$!
+	TST_CHECKPOINT_WAIT 0
+	echo $pid > tasks
+	signal_memcg_process $pid $PAGESIZE
+	echo $pid > ../tasks
 
 	# This expects that there is swap configured
 	EXPECT_PASS echo 1 \> memory.force_empty
@@ -27,31 +46,32 @@ test1()
 	stop_memcg_process $pid
 }
 
-test2()
+testcase_2()
 {
 	EXPECT_PASS echo 0 \> memory.force_empty
 }
 
-test3()
+testcase_3()
 {
 	EXPECT_PASS echo 1.0 \> memory.force_empty
 }
 
-test4()
+testcase_4()
 {
 	EXPECT_PASS echo 1xx \> memory.force_empty
 }
 
-test5()
+testcase_5()
 {
 	EXPECT_PASS echo xx \> memory.force_empty
 }
 
-test6()
+testcase_6()
 {
 	# writing to non-empty top mem cgroup's force_empty
 	# should return failure
 	EXPECT_FAIL echo 1 \> /dev/memcg/memory.force_empty
 }
 
-tst_run
+run_tests
+tst_exit

+ 382 - 182
ltp/testcases/bin/memcg_lib.sh

@@ -1,140 +1,100 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2019 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-TST_NEEDS_CHECKPOINTS=1
-TST_NEEDS_ROOT=1
-TST_NEEDS_TMPDIR=1
-TST_NEEDS_CMDS="killall find kill"
-TST_CLEANUP=memcg_cleanup
-TST_SETUP=memcg_setup
-TST_TESTFUNC=memcg_testfunc
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+## Author: Peng Haitao <penght@cn.fujitsu.com>                                ##
+##                                                                            ##
+################################################################################
 
-MEMCG_SHMMAX=${MEMCG_SHMMAX:-0}
-MEMCG_TESTFUNC=${MEMCG_TESTFUNC:-memcg_no_testfunc}
+TST_NEEDS_CHECKPOINTS=1
+. test.sh
 
-. cgroup_lib.sh
+if [ "x$(grep -w memory /proc/cgroups | cut -f4)" != "x1" ]; then
+	tst_brkm TCONF "Kernel does not support the memory resource controller"
+fi
 
 PAGESIZE=$(tst_getconf PAGESIZE)
 if [ $? -ne 0 ]; then
-	tst_brk TBROK "tst_getconf PAGESIZE failed"
+	tst_brkm TBROK "tst_getconf PAGESIZE failed"
 fi
 
+# Check for dependencies
+tst_require_cmds killall
+
 # Post 4.16 kernel updates stat in batch (> 32 pages) every time
-PAGESIZES=$(($PAGESIZE * 33))
+PAGESIZES=$(( $PAGESIZE * 33 ))
 
 HUGEPAGESIZE=$(awk '/Hugepagesize/ {print $2}' /proc/meminfo)
 [ -z $HUGEPAGESIZE ] && HUGEPAGESIZE=0
-HUGEPAGESIZE=$(($HUGEPAGESIZE * 1024))
+HUGEPAGESIZE=$(( $HUGEPAGESIZE * 1024 ))
+orig_memory_use_hierarchy=""
 
-orig_memory_use_hierarchy=
-orig_shmmax=
+MEMSW_USAGE_FLAG=0
+MEMSW_LIMIT_FLAG=0
 
-memcg_require_memsw()
-{
-	if ! [ -e /dev/memcg/memory.limit_in_bytes ]; then
-		tst_brk TBROK "/dev/memcg must be mounted before calling memcg_require_memsw"
-	fi
-	if ! [ -e /dev/memcg/memory.memsw.limit_in_bytes ]; then
-		tst_brk TCONF "mem+swap is not enabled"
-	fi
-}
+tst_tmpdir
+TMP_DIR="$PWD"
 
-memcg_require_hierarchy_disabled()
+cleanup()
 {
-	if [ ! -e "/dev/memcg/memory.use_hierarchy" ]; then
-		tst_brk TBROK "/dev/memcg must be mounted before calling memcg_require_hierarchy_disabled"
-	fi
-	if [ $(cat /dev/memcg/memory.use_hierarchy) -eq 1 ]; then
-		tst_brk TCONF "Test requires root cgroup memory.use_hierarchy=0"
+	if [ -n "$LOCAL_CLEANUP" ]; then
+		$LOCAL_CLEANUP
 	fi
-}
 
-memcg_setup()
-{
-	if ! is_cgroup_subsystem_available_and_enabled "memory"; then
-		tst_brk TCONF "Either kernel does not support Memory Resource Controller or feature not enabled"
-	fi
+	killall -9 memcg_process 2> /dev/null
+	wait
 
-	# Setup IPC
-	LTP_IPC_PATH="/dev/shm/ltp_${TCID}_$$"
-	LTP_IPC_SIZE=$PAGESIZE
-	ROD_SILENT dd if=/dev/zero of="$LTP_IPC_PATH" bs="$LTP_IPC_SIZE" count=1
-	ROD_SILENT chmod 600 "$LTP_IPC_PATH"
-	export LTP_IPC_PATH
-	# Setup IPC end
+	cd "$TMP_DIR"
 
-	ROD mkdir /dev/memcg
-	ROD mount -t cgroup -omemory memcg /dev/memcg
+	if [ -n "$TEST_ID" -a -d "/dev/memcg/$TEST_ID" ]; then
+		for i in "/dev/memcg/$TEST_ID/"*; do
+			if [ -d "$i" ]; then
+				rmdir "$i"
+			fi
+		done
 
-	# The default value for memory.use_hierarchy is 0 and some of tests
-	# (memcg_stat_test.sh and memcg_use_hierarchy_test.sh) expect it so
-	# while there are distributions (RHEL7U0Beta for example) that sets
-	# it to 1.
-	# Note: If there are already subgroups created it is not possible,
-	# to set this back to 0.
-	# This seems to be the default for all systems using systemd.
-	orig_memory_use_hierarchy=$(cat /dev/memcg/memory.use_hierarchy)
-	if [ -z "$orig_memory_use_hierarchy" ];then
-		tst_res TINFO "cat /dev/memcg/ failed"
-	elif [ "$orig_memory_use_hierarchy" = "0" ];then
-		orig_memory_use_hierarchy=""
-	else
-		echo 0 > /dev/memcg/memory.use_hierarchy 2>/dev/null
-		if [ $? -ne 0 ];then
-			tst_res TINFO "set /dev/memcg/memory.use_hierarchy to 0 failed"
-		fi
-	fi
-
-	[ "$MEMCG_SHMMAX" = "1" ] && shmmax_setup
-}
-
-memcg_cleanup()
-{
-	kill -9 $MEMCG_PROCESS_PID 2> /dev/null
-
-	cd $TST_TMPDIR
-	# In order to remove all subgroups, we have to remove them recursively
-	if [ -e /dev/memcg/ltp_$$ ]; then
-		ROD find /dev/memcg/ltp_$$ -depth -type d -delete
+		rmdir "/dev/memcg/$TEST_ID"
 	fi
 
-	if [ -n "$orig_memory_use_hierarchy" ];then
-		echo $orig_memory_use_hierarchy > /dev/memcg/memory.use_hierarchy
-		if [ $? -ne 0 ];then
-			tst_res TINFO "restore /dev/memcg/memory.use_hierarchy failed"
-		fi
-		orig_memory_use_hierarchy=""
-	fi
-
-	if [ -e "/dev/memcg" ]; then
+	if [ -d "/dev/memcg" ]; then
 		umount /dev/memcg
 		rmdir /dev/memcg
 	fi
 
-	[ "$MEMCG_SHMMAX" = "1" ] && shmmax_cleanup
+	tst_rmdir
 }
+TST_CLEANUP=cleanup
 
 shmmax_setup()
 {
 	tst_require_cmds bc
 
-	tst_res TINFO "Setting shmmax"
-
-	orig_shmmax=$(cat /proc/sys/kernel/shmmax)
-	if [ $(echo "$orig_shmmax < $HUGEPAGESIZE" | bc) -eq 1 ]; then
+	shmmax=`cat /proc/sys/kernel/shmmax`
+	if [ $(echo "$shmmax < $HUGEPAGESIZE" |bc) -eq 1 ]; then
 		ROD echo "$HUGEPAGESIZE" \> /proc/sys/kernel/shmmax
 	fi
 }
 
 shmmax_cleanup()
 {
-	if [ -n "$orig_shmmax" ]; then
-		echo "$orig_shmmax" > /proc/sys/kernel/shmmax
+	if [ -n "$shmmax" ]; then
+		echo "$shmmax" > /proc/sys/kernel/shmmax
 	fi
 }
 
@@ -143,36 +103,27 @@ shmmax_cleanup()
 # $2 - Expected size
 check_mem_stat()
 {
-	local item_size
-
 	if [ -e $1 ]; then
-		item_size=$(cat $1)
+		item_size=`cat $1`
 	else
-		item_size=$(grep -w $1 memory.stat | cut -d " " -f 2)
+		item_size=`grep -w $1 memory.stat | cut -d " " -f 2`
 	fi
 
 	if [ "$2" = "$item_size" ]; then
-		tst_res TPASS "$1 is $2 as expected"
+		tst_resm TPASS "$1 is $2 as expected"
 	else
-		tst_res TFAIL "$1 is $item_size, $2 expected"
+		tst_resm TFAIL "$1 is $item_size, $2 expected"
 	fi
 }
 
-start_memcg_process()
-{
-	tst_res TINFO "Running memcg_process $@"
-	memcg_process "$@" &
-	MEMCG_PROCESS_PID=$!
-	ROD tst_checkpoint wait 10000 0
-}
-
 signal_memcg_process()
 {
-	local size=$1
-	local path=$2
+	local pid=$1
+	local size=$2
+	local path=$3
 	local usage_start=$(cat ${path}memory.usage_in_bytes)
 
-	kill -s USR1 $MEMCG_PROCESS_PID 2> /dev/null
+	kill -s USR1 $pid 2> /dev/null
 
 	if [ -z "$size" ]; then
 		return
@@ -180,7 +131,7 @@ signal_memcg_process()
 
 	local loops=100
 
-	while kill -0 $MEMCG_PROCESS_PID 2> /dev/null; do
+	while kill -0 $pid 2> /dev/null; do
 		local usage=$(cat ${path}memory.usage_in_bytes)
 		local diff_a=$((usage_start - usage))
 		local diff_b=$((usage - usage_start))
@@ -193,32 +144,34 @@ signal_memcg_process()
 
 		loops=$((loops - 1))
 		if [ $loops -le 0 ]; then
-			tst_brk TBROK "timed out on memory.usage_in_bytes"
+			tst_brkm TBROK "timeouted on memory.usage_in_bytes"
 		fi
 	done
 }
 
 stop_memcg_process()
 {
-	[ -z "$MEMCG_PROCESS_PID" ] && return
-	kill -s INT $MEMCG_PROCESS_PID 2> /dev/null
-	wait $MEMCG_PROCESS_PID
-	MEMCG_PROCESS_PID=
+	local pid=$1
+	kill -s INT $pid 2> /dev/null
+	wait $pid
 }
 
 warmup()
 {
-	tst_res TINFO "Warming up pid: $MEMCG_PROCESS_PID"
-	signal_memcg_process
-	signal_memcg_process
+	local pid=$1
+
+	tst_resm TINFO "Warming up pid: $pid"
+	signal_memcg_process $pid
+	signal_memcg_process $pid
 	sleep 1
 
-	if ! kill -0 $MEMCG_PROCESS_PID; then
-		wait $MEMCG_PROCESS_PID
-		tst_res TFAIL "Process $MEMCG_PROCESS_PID exited with $? after warm up"
+	kill -0 $pid
+	if [ $? -ne 0 ]; then
+		wait $pid
+		tst_resm TFAIL "Process $pid exited with $? after warm up"
 		return 1
 	else
-		tst_res TINFO "Process is still here after warm up: $MEMCG_PROCESS_PID"
+		tst_resm TINFO "Process is still here after warm up: $pid"
 	fi
 
 	return 0
@@ -235,23 +188,86 @@ test_mem_stat()
 	local exp_stat_size=$5
 	local check_after_free=$6
 
-	start_memcg_process $memtypes -s $size
+	tst_resm TINFO "Running memcg_process $memtypes -s $size"
+	memcg_process $memtypes -s $size &
+	TST_CHECKPOINT_WAIT 0
 
-	if ! warmup; then
+	warmup $!
+	if [ $? -ne 0 ]; then
 		return
 	fi
 
-	echo $MEMCG_PROCESS_PID > tasks
-	signal_memcg_process $size
+	echo $! > tasks
+	signal_memcg_process $! $size
 
 	check_mem_stat $stat_name $exp_stat_size
 
-	signal_memcg_process $size
+	signal_memcg_process $! $size
 	if $check_after_free; then
 		check_mem_stat $stat_name 0
 	fi
 
-	stop_memcg_process
+	stop_memcg_process $!
+}
+
+# Run test cases which checks memory.max_usage_in_bytes after make
+# some memory allocation
+# $1 - the parameters of 'process', such as --shm
+# $2 - the -s parameter of 'process', such as 4096
+# $3 - item name
+# $4 - the expected size
+# $5 - check after free ?
+test_max_usage_in_bytes()
+{
+	tst_resm TINFO "Running memcg_process $1 -s $2"
+	memcg_process $1 -s $2 &
+	TST_CHECKPOINT_WAIT 0
+
+	warmup $!
+	if [ $? -ne 0 ]; then
+		return
+	fi
+
+	echo $! > tasks
+	signal_memcg_process $! $2
+	signal_memcg_process $! $2
+
+	check_mem_stat $3 $4
+
+	if [ $5 -eq 1 ]; then
+		echo 0 > $3
+		check_mem_stat $3 0
+	fi
+
+	stop_memcg_process $!
+}
+
+# make some memory allocation
+# $1 - the parameters of 'process', such as --shm
+# $2 - the -s parameter of 'process', such as 4096
+malloc_free_memory()
+{
+	tst_resm TINFO "Running memcg_process $1 -s $2"
+	memcg_process $1 -s $2 &
+	TST_CHECKPOINT_WAIT 0
+
+	echo $! > tasks
+	signal_memcg_process $! $2
+	signal_memcg_process $! $2
+
+	stop_memcg_process $!
+}
+
+# Test if failcnt > 0, which means page reclamation occured
+# $1 - item name in memcg
+test_failcnt()
+{
+	failcnt=`cat $1`
+	if [ $failcnt -gt 0 ]; then
+		tst_resm TPASS "$1 is $failcnt, > 0 as expected"
+	else
+		tst_resm TFAIL "$1 is $failcnt, <= 0 expected"
+	fi
 }
 
 # Test process will be killed due to exceed memory limit
@@ -261,27 +277,28 @@ test_mem_stat()
 # $4 - use mem+swap limitation
 test_proc_kill()
 {
-	local limit=$1
-	local memtypes="$2"
-	local size=$3
-	local use_memsw=$4
-	local tpk_iter
-
-	echo $limit > memory.limit_in_bytes
-	if [ $use_memsw -eq 1 ]; then
-		memcg_require_memsw
-		echo $limit > memory.memsw.limit_in_bytes
+	echo $1 > memory.limit_in_bytes
+	if [ $4 -eq 1 ]; then
+		if [ -e memory.memsw.limit_in_bytes ]; then
+			echo $1 > memory.memsw.limit_in_bytes
+		else
+			tst_resm TCONF "mem+swap is not enabled"
+			return
+		fi
 	fi
 
-	start_memcg_process $memtypes -s $size
-	echo $MEMCG_PROCESS_PID > tasks
+	memcg_process $2 -s $3 &
+	pid=$!
+	TST_CHECKPOINT_WAIT 0
+	echo $pid > tasks
+	sleep 1
 
-	signal_memcg_process $size
+	signal_memcg_process $pid $3
 
-	local tpk_pid_exists=1
+	tpk_pid_exists=1
 	for tpk_iter in $(seq 20); do
-		if [ ! -d "/proc/$MEMCG_PROCESS_PID" ] ||
-			grep -q 'Z (zombie)' "/proc/$MEMCG_PROCESS_PID/status"; then
+		if [ ! -d "/proc/$pid" ] ||
+			grep -q 'Z (zombie)' "/proc/$pid/status"; then
 			tpk_pid_exists=0
 			break
 		fi
@@ -290,18 +307,18 @@ test_proc_kill()
 	done
 
 	if [ $tpk_pid_exists -eq 0 ]; then
-		wait $MEMCG_PROCESS_PID
+		wait $pid
 		ret=$?
 		if [ $ret -eq 1 ]; then
-			tst_res TFAIL "process $MEMCG_PROCESS_PID is killed by error"
+			tst_resm TFAIL "process $pid is killed by error"
 		elif [ $ret -eq 2 ]; then
-			tst_res TPASS "Failed to lock memory"
+			tst_resm TPASS "Failed to lock memory"
 		else
-			tst_res TPASS "process $MEMCG_PROCESS_PID is killed"
+			tst_resm TPASS "process $pid is killed"
 		fi
 	else
-		stop_memcg_process
-		tst_res TFAIL "process $MEMCG_PROCESS_PID is not killed"
+		stop_memcg_process $!
+		tst_resm TFAIL "process $pid is not killed"
 	fi
 }
 
@@ -310,46 +327,229 @@ test_proc_kill()
 # $2 - use mem+swap limitation
 test_limit_in_bytes()
 {
-	local limit=$1
-	local use_memsw=$2
-	local elimit
-
-	echo $limit > memory.limit_in_bytes
-	if [ $use_memsw -eq 1 ]; then
-		memcg_require_memsw
-		echo $limit > memory.memsw.limit_in_bytes
-		elimit=$(cat memory.memsw.limit_in_bytes)
+	echo $1 > memory.limit_in_bytes
+	if [ $2 -eq 1 ]; then
+		if [ -e memory.memsw.limit_in_bytes ]; then
+			echo $1 > memory.memsw.limit_in_bytes
+			limit=`cat memory.memsw.limit_in_bytes`
+		else
+			tst_resm TCONF "mem+swap is not enabled"
+			return
+		fi
 	else
-		elimit=$(cat memory.limit_in_bytes)
+		limit=`cat memory.limit_in_bytes`
 	fi
 
-	# Kernels prior to 3.19 were rounding up,
-	# but newer kernels are rounding down
-	local limit_up=$(( PAGESIZE * (limit / PAGESIZE) ))
-	local limit_down=$(( PAGESIZE * ((limit + PAGESIZE - 1) / PAGESIZE) ))
-	if [ $limit_up -eq $elimit ] || [ $limit_down -eq $elimit ]; then
-		tst_res TPASS "input=$limit, limit_in_bytes=$elimit"
+	# Kernels prior to 3.19 were rounding up but newer kernels
+	# are rounding down
+	if [ \( $(($PAGESIZE*($1/$PAGESIZE))) -eq $limit \) \
+	    -o \( $(($PAGESIZE*(($1+$PAGESIZE-1)/$PAGESIZE))) -eq $limit \) ]; then
+		tst_resm TPASS "input=$1, limit_in_bytes=$limit"
 	else
-		tst_res TFAIL "input=$limit, limit_in_bytes=$elimit"
+		tst_resm TFAIL "input=$1, limit_in_bytes=$limit"
 	fi
 }
 
-memcg_testfunc()
+# Never used, so untested
+#
+# Test memory controller doesn't charge hugepage
+# $1 - the value of /proc/sys/vm/nr_hugepages
+# $2 - the parameters of 'process', --mmap-file or --shm
+# $3 - the -s parameter of 'process', such as $HUGEPAGESIZE
+# $4 - 0: expected failure, 1: expected success
+test_hugepage()
 {
-	ROD mkdir /dev/memcg/ltp_$$
-	cd /dev/memcg/ltp_$$
+	TMP_FILE="$TMP_DIR/tmp"
+	nr_hugepages=`cat /proc/sys/vm/nr_hugepages`
+
+	mkdir /hugetlb
+	mount -t hugetlbfs none /hugetlb
+
+	echo $1 > /proc/sys/vm/nr_hugepages
+
+	memcg_process $2 --hugepage -s $3 > $TMP_FILE 2>&1 &
+	TST_CHECKPOINT_WAIT 0
 
-	if type ${MEMCG_TESTFUNC}1 > /dev/null 2>&1; then
-		${MEMCG_TESTFUNC}$1 $1 "$2"
+	signal_memcg_process $! $3
+
+	check_mem_stat "rss" 0
+
+	echo "TMP_FILE:"
+	cat $TMP_FILE
+
+	if [ $4 -eq 0 ]; then
+		test -s $TMP_FILE
+		if [ $? -eq 0 ]; then
+			tst_resm TPASS "allocate hugepage failed as expected"
+		else
+			signal_memcg_process $! $3
+			stop_memcg_process $!
+			tst_resm TFAIL "allocate hugepage should fail"
+		fi
 	else
-		${MEMCG_TESTFUNC} $1 "$2"
+		test ! -s $TMP_FILE
+		if [ $? -eq 0 ]; then
+			signal_memcg_process $! $3
+			stop_memcg_process $!
+			tst_resm TPASS "allocate hugepage succeeded"
+		else
+			tst_resm TFAIL "allocate hugepage failed"
+		fi
 	fi
 
-	cd $TST_TMPDIR
-	ROD rmdir /dev/memcg/ltp_$$
+	sleep 1
+	rm -rf $TMP_FILE
+	umount /hugetlb
+	rmdir /hugetlb
+	echo $nr_hugepages > /proc/sys/vm/nr_hugepages
 }
 
-memcg_no_testfunc()
+# Test the memory charge won't move to subgroup
+# $1 - memory.limit_in_bytes in parent group
+# $2 - memory.limit_in_bytes in sub group
+test_subgroup()
 {
-	tst_brk TBROK "No testfunc specified, set MEMCG_TESTFUNC"
+	mkdir subgroup
+	echo $1 > memory.limit_in_bytes
+	echo $2 > subgroup/memory.limit_in_bytes
+
+	tst_resm TINFO "Running memcg_process --mmap-anon -s $PAGESIZES"
+	memcg_process --mmap-anon -s $PAGESIZES &
+	TST_CHECKPOINT_WAIT 0
+
+	warmup $! $PAGESIZES
+	if [ $? -ne 0 ]; then
+		return
+	fi
+
+	echo $! > tasks
+	signal_memcg_process $! $PAGESIZES
+	check_mem_stat "rss" $PAGESIZES
+
+	cd subgroup
+	echo $! > tasks
+	check_mem_stat "rss" 0
+
+	# cleanup
+	cd ..
+	echo $! > tasks
+	stop_memcg_process $!
+	rmdir subgroup
+}
+
+# Run test cases which test memory.move_charge_at_immigrate
+test_move_charge()
+{
+	local memtypes="$1"
+	local size=$2
+	local total_size=$3
+	local move_charge_mask=$4
+	local b_rss=$5
+	local b_cache=$6
+	local a_rss=$7
+	local a_cache=$8
+
+	mkdir subgroup_a
+
+	tst_resm TINFO "Running memcg_process $memtypes -s $size"
+	memcg_process $memtypes -s $size &
+	TST_CHECKPOINT_WAIT 0
+	warmup $!
+	if [ $? -ne 0 ]; then
+		rmdir subgroup_a
+		return
+	fi
+
+	echo $! > subgroup_a/tasks
+	signal_memcg_process $! $total_size "subgroup_a/"
+
+	mkdir subgroup_b
+	echo $move_charge_mask > subgroup_b/memory.move_charge_at_immigrate
+	echo $! > subgroup_b/tasks
+
+	cd subgroup_b
+	check_mem_stat "rss" $b_rss
+	check_mem_stat "cache" $b_cache
+	cd ../subgroup_a
+	check_mem_stat "rss" $a_rss
+	check_mem_stat "cache" $a_cache
+	cd ..
+	stop_memcg_process $!
+	rmdir subgroup_a subgroup_b
+}
+
+cleanup_test()
+{
+	TEST_ID="$1"
+
+	if [ -n "$orig_memory_use_hierarchy" ];then
+		echo $orig_memory_use_hierarchy > \
+		     /dev/memcg/memory.use_hierarchy
+		if [ $? -ne 0 ];then
+			tst_resm TINFO "restore "\
+				 "/dev/memcg/memory.use_hierarchy failed"
+		fi
+		orig_memory_use_hierarchy=""
+	fi
+
+	killall -9 memcg_process 2>/dev/null
+	wait
+
+	ROD cd "$TMP_DIR"
+
+	ROD rmdir "/dev/memcg/$TEST_ID"
+	TEST_ID=""
+	ROD umount /dev/memcg
+	ROD rmdir /dev/memcg
+}
+
+setup_test()
+{
+	TEST_ID="$1"
+
+	ROD mkdir /dev/memcg
+	ROD mount -t cgroup -omemory memcg /dev/memcg
+
+	# The default value for memory.use_hierarchy is 0 and some of tests
+	# (memcg_stat_test.sh and memcg_use_hierarchy_test.sh) expect it so
+	# while there are distributions (RHEL7U0Beta for example) that sets
+	# it to 1.
+	orig_memory_use_hierarchy=$(cat /dev/memcg/memory.use_hierarchy)
+	if [ -z "$orig_memory_use_hierarchy" ];then
+		tst_resm TINFO "cat /dev/memcg/memory.use_hierarchy failed"
+	elif [ "$orig_memory_use_hierarchy" = "0" ];then
+		orig_memory_use_hierarchy=""
+	else
+		echo 0 > /dev/memcg/memory.use_hierarchy
+		if [ $? -ne 0 ];then
+			tst_resm TINFO "set /dev/memcg/memory.use_hierarchy" \
+				"to 0 failed"
+		fi
+	fi
+
+	ROD mkdir "/dev/memcg/$TEST_ID"
+	ROD cd "/dev/memcg/$TEST_ID"
+}
+
+# Run all the test cases
+run_tests()
+{
+	for i in $(seq 1 $TST_TOTAL); do
+
+		tst_resm TINFO "Starting test $i"
+
+		setup_test $i
+
+		if [ -e memory.memsw.limit_in_bytes ]; then
+			MEMSW_LIMIT_FLAG=1
+		fi
+
+		if [ -e memory.memsw.max_usage_in_bytes ]; then
+			MEMSW_USAGE_FLAG=1
+		fi
+
+		testcase_$i
+
+		cleanup_test $i
+	done
 }

+ 59 - 47
ltp/testcases/bin/memcg_limit_in_bytes.sh

@@ -1,94 +1,103 @@
 #!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functionality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
-
-MEMCG_TESTFUNC=test
-MEMCG_SHMMAX=1
-TST_CNT=15
 
-. memcg_lib.sh
-TST_CLEANUP=cleanup
+################################################################################
+##                                                                            ##
+## Copyright (c) 2009 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software Foundation,   ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA           ##
+##                                                                            ##
+## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>                     ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak		      ##
+##						<risrajak@linux.vnet.ibm.com  ##
+##                                                                            ##
+################################################################################
+
+TCID="memcg_limit_in_bytes"
+TST_TOTAL=15
 
-cleanup()
-{
-	memcg_cleanup
-	swapon -a
-}
+. memcg_lib.sh
 
-test1()
+# Test mmap(locked) + alloc_mem > limit_in_bytes
+testcase_1()
 {
-	tst_res TINFO "Test mmap(locked) + alloc_mem > limit_in_bytes"
-	test_proc_kill $PAGESIZE "--mmap-lock1" $((PAGESIZE * 2)) 0
+	test_proc_kill $PAGESIZE "--mmap-lock1" $((PAGESIZE*2)) 0
 }
 
-test2()
+testcase_2()
 {
-	test_proc_kill $PAGESIZE "--mmap-lock2" $((PAGESIZE * 2)) 0
+	test_proc_kill $PAGESIZE "--mmap-lock2" $((PAGESIZE*2)) 0
 }
 
-test3()
+# Test swapoff + alloc_mem > limit_in_bytes
+testcase_3()
 {
-	tst_res TINFO "Test swapoff + alloc_mem > limit_in_bytes"
 	swapoff -a
-	test_proc_kill $PAGESIZE "--mmap-anon" $((PAGESIZE * 2)) 0
+	test_proc_kill $PAGESIZE "--mmap-anon" $((PAGESIZE*2)) 0
 	swapon -a
 }
 
-test4()
+testcase_4()
 {
 	swapoff -a
-	test_proc_kill $PAGESIZE "--mmap-file" $((PAGESIZE * 2)) 0
+	test_proc_kill $PAGESIZE "--mmap-file" $((PAGESIZE*2)) 0
 	swapon -a
 }
 
-test5()
+testcase_5()
 {
 	swapoff -a
-	test_proc_kill $PAGESIZE "--shm -k 18" $((PAGESIZE * 2)) 0
+	test_proc_kill $PAGESIZE "--shm -k 18" $((PAGESIZE*2)) 0
 	swapon -a
 }
 
-test6()
+# Test limit_in_bytes == 0
+testcase_6()
 {
-	tst_res TINFO "Test limit_in_bytes == 0"
 	test_proc_kill 0 "--mmap-anon" $PAGESIZE 0
 }
 
-test7()
+testcase_7()
 {
 	test_proc_kill 0 "--mmap-file" $PAGESIZE 0
 }
 
-test8()
+testcase_8()
 {
 	test_proc_kill 0 "--shm -k 21" $PAGESIZE 0
 }
 
-test9()
+# Test limit_in_bytes will be aligned to PAGESIZE
+testcase_9()
 {
-	tst_res TINFO "Test limit_in_bytes will be aligned to PAGESIZE"
-	test_limit_in_bytes $((PAGESIZE - 1)) 0
+	test_limit_in_bytes $((PAGESIZE-1)) 0
 }
 
-test10()
+testcase_10()
 {
-	test_limit_in_bytes $((PAGESIZE + 1)) 0
+	test_limit_in_bytes $((PAGESIZE+1)) 0
 }
 
-test11()
+testcase_11()
 {
 	test_limit_in_bytes 1 0
 }
 
-test12()
+# Test invalid memory.limit_in_bytes
+testcase_12()
 {
-	tst_res TINFO "Test invalid memory.limit_in_bytes"
 	if tst_kvcmp -lt "2.6.31"; then
 		EXPECT_FAIL echo -1 \> memory.limit_in_bytes
 	else
@@ -96,19 +105,22 @@ test12()
 	fi
 }
 
-test13()
+testcase_13()
 {
 	EXPECT_FAIL echo 1.0 \> memory.limit_in_bytes
 }
 
-test14()
+testcase_14()
 {
 	EXPECT_FAIL echo 1xx \> memory.limit_in_bytes
 }
 
-test15()
+testcase_15()
 {
 	EXPECT_FAIL echo xx \> memory.limit_in_bytes
 }
 
-tst_run
+shmmax_setup
+LOCAL_CLEANUP=shmmax_cleanup
+run_tests
+tst_exit

+ 57 - 55
ltp/testcases/bin/memcg_max_usage_in_bytes_test.sh

@@ -1,77 +1,79 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+################################################################################
+#
+# File :        memcg_max_usage_in_bytes_test.sh
+# Description:  Tests memory.max_usage_in_bytes.
+# Author:       Peng Haitao <penght@cn.fujitsu.com>
+# History:      2012/01/17 - Created.
 #
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-MEMCG_TESTFUNC=test
-TST_CNT=4
+TCID="memcg_max_usage_in_bytes_test"
+TST_TOTAL=4
 
 . memcg_lib.sh
 
-MEM_TO_ALLOC=$((PAGESIZE * 1024))
-MEM_LIMIT=$((MEM_TO_ALLOC * 2))
-
-# Run test cases which checks memory.[memsw.]max_usage_in_bytes after make
-# some memory allocation
-test_max_usage_in_bytes()
+# Test memory.max_usage_in_bytes
+testcase_1()
 {
-	local item="memory.max_usage_in_bytes"
-	[ $1 -eq 1 ] && item="memory.memsw.max_usage_in_bytes"
-	local check_after_reset=$2
-	start_memcg_process --mmap-anon -s $MEM_TO_ALLOC
+	test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+		"memory.max_usage_in_bytes" $((PAGESIZE*1024)) 0
+}
 
-	warmup
-	if [ $? -ne 0 ]; then
+# Test memory.memsw.max_usage_in_bytes
+testcase_2()
+{
+	if [ "$MEMSW_USAGE_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
 		return
 	fi
 
-	echo $MEMCG_PROCESS_PID > tasks
-	signal_memcg_process $MEM_TO_ALLOC
-	signal_memcg_process $MEM_TO_ALLOC
-
-	check_mem_stat $item $MEM_TO_ALLOC
-
-	if [ $check_after_reset -eq 1 ]; then
-		echo 0 > $item
-		check_mem_stat $item 0
-	fi
-
-	stop_memcg_process
+	echo $((PAGESIZE*2048)) > memory.limit_in_bytes
+	echo $((PAGESIZE*2048)) > memory.memsw.limit_in_bytes
+	test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+		"memory.memsw.max_usage_in_bytes" $((PAGESIZE*1024)) 0
 }
 
-test1()
+# Test reset memory.max_usage_in_bytes
+testcase_3()
 {
-	tst_res TINFO "Test memory.max_usage_in_bytes"
-	test_max_usage_in_bytes 0 0
+	test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+		"memory.max_usage_in_bytes" $((PAGESIZE*1024)) 1
 }
 
-test2()
+# Test reset memory.memsw.max_usage_in_bytes
+testcase_4()
 {
-	tst_res TINFO "Test memory.memsw.max_usage_in_bytes"
-	memcg_require_memsw
-
-	echo $MEM_LIMIT > memory.limit_in_bytes
-	echo $MEM_LIMIT > memory.memsw.limit_in_bytes
-	test_max_usage_in_bytes 1 0
-}
+	if [ "$MEMSW_USAGE_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
-test3()
-{
-	tst_res TINFO "Test reset memory.max_usage_in_bytes"
-	test_max_usage_in_bytes 0 1
+	echo $((PAGESIZE*2048)) > memory.limit_in_bytes
+	echo $((PAGESIZE*2048)) > memory.memsw.limit_in_bytes
+	test_max_usage_in_bytes "--mmap-anon" $((PAGESIZE*1024)) \
+		"memory.memsw.max_usage_in_bytes" $((PAGESIZE*1024)) 1
 }
 
-test4()
-{
-	tst_res TINFO "Test reset memory.memsw.max_usage_in_bytes"
-	memcg_require_memsw
+run_tests
 
-	echo $MEM_LIMIT > memory.limit_in_bytes
-	echo $MEM_LIMIT > memory.memsw.limit_in_bytes
-	test_max_usage_in_bytes 1 1
-}
+tst_exit
 
-tst_run

+ 60 - 26
ltp/testcases/bin/memcg_memsw_limit_in_bytes_test.sh

@@ -1,59 +1,82 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+################################################################################
+#
+# File :        memcg_memsw_limit_in_bytes_test.sh
+# Description:  Tests memory.memsw.limit_in_bytes.
+# Author:       Peng Haitao <penght@cn.fujitsu.com>
+# History:      2012/01/3 - Created.
 #
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-MEMCG_TESTFUNC=test
-TST_CNT=12
+TCID="memcg_memsw_limit_in_bytes_test"
+TST_TOTAL=12
 
 . memcg_lib.sh
 
-test1()
+testcase_1()
 {
 	test_proc_kill $PAGESIZE "--mmap-lock1" $((PAGESIZE*2)) 1
 }
 
-test2()
+testcase_2()
 {
 	test_proc_kill $PAGESIZE "--mmap-lock2" $((PAGESIZE*2)) 1
 }
 
-test3()
+testcase_3()
 {
 	test_proc_kill 0 "--mmap-anon" $PAGESIZE 1
 }
 
-test4()
+testcase_4()
 {
 	test_proc_kill 0 "--mmap-file" $PAGESIZE 1
 }
 
-test5()
+testcase_5()
 {
 	test_proc_kill 0 "--shm -k 21" $PAGESIZE 1
 }
 
-test6()
+testcase_6()
 {
-	test_limit_in_bytes $((PAGESIZE - 1)) 1
+	test_limit_in_bytes $((PAGESIZE-1)) 1
 }
 
-test7()
+testcase_7()
 {
-	test_limit_in_bytes $((PAGESIZE + 1)) 1
+	test_limit_in_bytes $((PAGESIZE+1)) 1
 }
 
-test8()
+testcase_8()
 {
 	test_limit_in_bytes 1 1
 }
 
-test9()
+testcase_9()
 {
-	memcg_require_memsw
+	if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
 	echo 10M > memory.limit_in_bytes
 
@@ -64,28 +87,39 @@ test9()
 	fi
 }
 
-test10()
+testcase_10()
 {
-	memcg_require_memsw
+	if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
 	echo 10M > memory.limit_in_bytes
 	EXPECT_FAIL echo 1.0 \> memory.memsw.limit_in_bytes
 }
 
-test11()
+testcase_11()
 {
-	memcg_require_memsw
+	if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
 	echo 10M > memory.limit_in_bytes
 	EXPECT_FAIL echo 1xx \> memory.memsw.limit_in_bytes
 }
 
-test12()
+testcase_12()
 {
-	memcg_require_memsw
+	if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
 	echo 10M > memory.limit_in_bytes
 	EXPECT_FAIL echo xx \> memory.memsw.limit_in_bytes
 }
 
-tst_run
+run_tests
+
+tst_exit

+ 41 - 61
ltp/testcases/bin/memcg_move_charge_at_immigrate_test.sh

@@ -1,83 +1,63 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2018 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+################################################################################
+#
+# File :        memcg_move_charge_at_immigrate_test.sh
+# Description:  Tests memory.move_charge_at_immigrate.
+# Author:       Peng Haitao <penght@cn.fujitsu.com>
+# History:      2012/01/16 - Created.
 #
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-MEMCG_TESTFUNC=test
-TST_CNT=4
+TCID="memcg_move_charge_at_immigrate_test"
+TST_TOTAL=4
 
 . memcg_lib.sh
 
-
-# Run test cases which test memory.move_charge_at_immigrate
-test_move_charge()
-{
-	local memtypes="$1"
-	local size=$2
-	local total_size=$3
-	local move_charge_mask=$4
-	local b_rss=$5
-	local b_cache=$6
-	local a_rss=$7
-	local a_cache=$8
-
-	mkdir subgroup_a
-
-	start_memcg_process $memtypes -s $size
-
-	warmup
-	if [ $? -ne 0 ]; then
-		rmdir subgroup_a
-		return
-	fi
-
-	echo $MEMCG_PROCESS_PID > subgroup_a/tasks
-	signal_memcg_process $total_size "subgroup_a/"
-
-	mkdir subgroup_b
-	echo $move_charge_mask > subgroup_b/memory.move_charge_at_immigrate
-	echo $MEMCG_PROCESS_PID > subgroup_b/tasks
-
-	cd subgroup_b
-	check_mem_stat "rss" $b_rss
-	check_mem_stat "cache" $b_cache
-	cd ../subgroup_a
-	check_mem_stat "rss" $a_rss
-	check_mem_stat "cache" $a_cache
-	cd ..
-	stop_memcg_process
-	rmdir subgroup_a subgroup_b
-}
-
-
-test1()
+# Test disable moving charges
+testcase_1()
 {
-	tst_res TINFO "Test disable moving charges"
 	test_move_charge "--mmap-anon" $PAGESIZES $PAGESIZES 0 0 0 $PAGESIZES 0
 }
 
-test2()
+# Test move anon
+testcase_2()
 {
-	tst_res TINFO "Test move anon"
 	test_move_charge "--mmap-anon --shm --mmap-file" $PAGESIZES \
-		$((PAGESIZES * 3)) 1 $PAGESIZES 0 0 $((PAGESIZES * 2))
+		$((PAGESIZES*3)) 1 $PAGESIZES 0 0 $((PAGESIZES*2))
 }
 
-test3()
+# Test move file
+testcase_3()
 {
-	tst_res TINFO "Test move file"
 	test_move_charge "--mmap-anon --shm --mmap-file" $PAGESIZES \
-		$((PAGESIZES * 3)) 2 0 $((PAGESIZES * 2)) $PAGESIZES 0
+		$((PAGESIZES*3)) 2 0 $((PAGESIZES*2)) $PAGESIZES 0
 }
 
-test4()
+# Test move anon and file
+testcase_4()
 {
-	tst_res TINFO "Test move anon and file"
 	test_move_charge "--mmap-anon --shm" $PAGESIZES \
-		$((PAGESIZES * 2)) 3 $PAGESIZES $PAGESIZES 0 0
+		$((PAGESIZES*2)) 3 $PAGESIZES $PAGESIZES 0 0
 }
 
-tst_run
+run_tests
+
+tst_exit

+ 43 - 25
ltp/testcases/bin/memcg_stat_rss.sh

@@ -1,71 +1,89 @@
 #!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2018 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functinality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com
 
-MEMCG_TESTFUNC=test
-MEMCG_SHMMAX=1
-TST_CNT=10
+################################################################################
+##                                                                            ##
+## Copyright (c) 2009 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software Foundation,   ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA           ##
+##                                                                            ##
+## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>                     ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak		      ##
+##						<risrajak@linux.vnet.ibm.com  ##
+##                                                                            ##
+################################################################################
+
+TCID="memcg_stat_rss"
+TST_TOTAL=10
 
 . memcg_lib.sh
 
 # Test the management and counting of memory
-test1()
+testcase_1()
 {
 	test_mem_stat "--mmap-anon" $PAGESIZES $PAGESIZES "rss" $PAGESIZES false
 }
 
-test2()
+testcase_2()
 {
 	test_mem_stat "--mmap-file" $PAGESIZE $PAGESIZE "rss" 0 false
 }
 
-test3()
+testcase_3()
 {
 	test_mem_stat "--shm -k 3" $PAGESIZE $PAGESIZE "rss" 0 false
 }
 
-test4()
+testcase_4()
 {
 	test_mem_stat "--mmap-anon --mmap-file --shm" \
-		$PAGESIZES $((PAGESIZES * 3)) "rss" $PAGESIZES false
+		$PAGESIZES $((PAGESIZES*3)) "rss" $PAGESIZES false
 }
 
-test5()
+testcase_5()
 {
 	test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES "rss" $PAGESIZES false
 }
 
-test6()
+testcase_6()
 {
 	test_mem_stat "--mmap-anon" $PAGESIZES $PAGESIZES "rss" $PAGESIZES true
 }
 
-test7()
+testcase_7()
 {
 	test_mem_stat "--mmap-file" $PAGESIZE $PAGESIZE "rss" 0 true
 }
 
-test8()
+testcase_8()
 {
 	test_mem_stat "--shm -k 8" $PAGESIZE $PAGESIZE "rss" 0 true
 }
 
-test9()
+testcase_9()
 {
 	test_mem_stat "--mmap-anon --mmap-file --shm" \
-		$PAGESIZES $((PAGESIZES * 3)) "rss" $PAGESIZES true
+		$PAGESIZES $((PAGESIZES*3)) "rss" $PAGESIZES true
 }
 
-test10()
+testcase_10()
 {
 	test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES "rss" $PAGESIZES true
 }
 
-tst_run
+shmmax_setup
+LOCAL_CLEANUP=shmmax_cleanup
+run_tests
+tst_exit

+ 77 - 51
ltp/testcases/bin/memcg_stat_test.sh

@@ -1,116 +1,142 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2018 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+################################################################################
+#
+# File :        memcg_stat_test.sh
+# Description:  Tests memory.stat.
+# Author:       Peng Haitao <penght@cn.fujitsu.com>
+# History:      2012/01/16 - Created.
 #
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-MEMCG_TESTFUNC=test
-TST_CNT=8
+TCID="memcg_stat_test"
+TST_TOTAL=8
 
 . memcg_lib.sh
 
-test1()
+# Test cache
+testcase_1()
 {
-	tst_res TINFO "Test cache"
 	test_mem_stat "--shm -k 3" $PAGESIZES $PAGESIZES "cache" $PAGESIZES false
 }
 
-test2()
+# Test mapped_file
+testcase_2()
 {
-	tst_res TINFO "Test mapped_file"
 	test_mem_stat "--mmap-file" $PAGESIZES $PAGESIZES \
 		"mapped_file" $PAGESIZES false
 }
 
-test3()
+# Test unevictable with MAP_LOCKED
+testcase_3()
 {
-	tst_res TINFO "Test unevictable with MAP_LOCKED"
-	test_mem_stat "--mmap-lock1" $PAGESIZES $PAGESIZES \
-		"unevictable" $PAGESIZES false
+	test_mem_stat "--mmap-lock1" $PAGESIZE $PAGESIZE \
+		"unevictable" $PAGESIZE false
 }
 
-test4()
+# Test unevictable with mlock
+testcase_4()
 {
-	tst_res TINFO "Test unevictable with mlock"
-	test_mem_stat "--mmap-lock2" $PAGESIZES $PAGESIZES \
-		"unevictable" $PAGESIZES false
+	test_mem_stat "--mmap-lock2" $PAGESIZE $PAGESIZE \
+		"unevictable" $PAGESIZE false
 }
 
-test5()
+# Test hierarchical_memory_limit with enabling hierarchical accounting
+testcase_5()
 {
-	tst_res TINFO "Test hierarchical_memory_limit with enabling hierarchical accounting"
 	echo 1 > memory.use_hierarchy
 
 	mkdir subgroup
-	echo $PAGESIZES > memory.limit_in_bytes
-	echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
+	echo $PAGESIZE > memory.limit_in_bytes
+	echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
 
 	cd subgroup
-	check_mem_stat "hierarchical_memory_limit" $PAGESIZES
+	check_mem_stat "hierarchical_memory_limit" $PAGESIZE
 
 	cd ..
 	rmdir subgroup
 }
 
-test6()
+# Test hierarchical_memory_limit with disabling hierarchical accounting
+testcase_6()
 {
-	tst_res TINFO "Test hierarchical_memory_limit with disabling hierarchical accounting"
-	memcg_require_hierarchy_disabled
-
 	echo 0 > memory.use_hierarchy
 
 	mkdir subgroup
-	echo $PAGESIZES > memory.limit_in_bytes
-	echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
+	echo $PAGESIZE > memory.limit_in_bytes
+	echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
 
 	cd subgroup
-	check_mem_stat "hierarchical_memory_limit" $((PAGESIZES * 2))
+	check_mem_stat "hierarchical_memory_limit" $((PAGESIZE*2))
 
 	cd ..
 	rmdir subgroup
 }
 
-test7()
+# Test hierarchical_memsw_limit with enabling hierarchical accounting
+testcase_7()
 {
-	tst_res TINFO "Test hierarchical_memsw_limit with enabling hierarchical accounting"
-	memcg_require_memsw
+	if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
-	ROD echo 1 \> memory.use_hierarchy
+	echo 1 > memory.use_hierarchy
 
 	mkdir subgroup
-	echo $PAGESIZES > memory.limit_in_bytes
-	echo $PAGESIZES > memory.memsw.limit_in_bytes
-	echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
-	echo $((PAGESIZES * 2)) > subgroup/memory.memsw.limit_in_bytes
+	echo $PAGESIZE > memory.limit_in_bytes
+	echo $PAGESIZE > memory.memsw.limit_in_bytes
+	echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
+	echo $((PAGESIZE*2)) > subgroup/memory.memsw.limit_in_bytes
 
 	cd subgroup
-	check_mem_stat "hierarchical_memsw_limit" $PAGESIZES
+	check_mem_stat "hierarchical_memsw_limit" $PAGESIZE
 
 	cd ..
 	rmdir subgroup
 }
 
-test8()
+# Test hierarchical_memsw_limit with disabling hierarchical accounting
+testcase_8()
 {
-	tst_res TINFO "Test hierarchical_memsw_limit with disabling hierarchical accounting"
-	memcg_require_memsw
-	memcg_require_hierarchy_disabled
+	if [ "$MEMSW_LIMIT_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
-	ROD echo 0 \> memory.use_hierarchy
+	echo 0 > memory.use_hierarchy
 
 	mkdir subgroup
-	echo $PAGESIZES > memory.limit_in_bytes
-	echo $PAGESIZES > memory.memsw.limit_in_bytes
-	echo $((PAGESIZES * 2)) > subgroup/memory.limit_in_bytes
-	echo $((PAGESIZES * 2)) > subgroup/memory.memsw.limit_in_bytes
+	echo $PAGESIZE > memory.limit_in_bytes
+	echo $PAGESIZE > memory.memsw.limit_in_bytes
+	echo $((PAGESIZE*2)) > subgroup/memory.limit_in_bytes
+	echo $((PAGESIZE*2)) > subgroup/memory.memsw.limit_in_bytes
 
 	cd subgroup
-	check_mem_stat "hierarchical_memsw_limit" $((PAGESIZES * 2))
+	check_mem_stat "hierarchical_memsw_limit" $((PAGESIZE*2))
 
 	cd ..
 	rmdir subgroup
 }
 
-tst_run
+run_tests
+
+tst_exit
+

+ 34 - 47
ltp/testcases/bin/memcg_subgroup_charge.sh

@@ -1,63 +1,50 @@
 #!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2009 FUJITSU LIMITED
-# Copyright (c) 2016 Cyril Hrubis <chrubis@suse.cz>
-# Copyright (c) 2018 Xiao Yang <yangx.jy@cn.fujitsu.com>
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
-#
-# Author: Li Zefan <lizf@cn.fujitsu.com>
-# Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>
-# Added memcg enable/disable functinality: Rishikesh K Rajak <risrajak@linux.vnet.ibm.com
 
-MEMCG_TESTFUNC=test
-TST_CNT=3
+################################################################################
+##                                                                            ##
+## Copyright (c) 2009 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software Foundation,   ##
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA           ##
+##                                                                            ##
+## Author: Li Zefan <lizf@cn.fujitsu.com>                                     ##
+## Restructure for LTP: Shi Weihua <shiwh@cn.fujitsu.com>                     ##
+## Added memcg enable/disable functinality: Rishikesh K Rajak		      ##
+##						<risrajak@linux.vnet.ibm.com  ##
+##                                                                            ##
+################################################################################
+
+TCID="memcg_subgroup_charge"
+TST_TOTAL=3
 
 . memcg_lib.sh
 
-# Test the memory charge won't move to subgroup
-# $1 - memory.limit_in_bytes in parent group
-# $2 - memory.limit_in_bytes in sub group
-test_subgroup()
+# Test that group and subgroup have no relationship
+testcase_1()
 {
-	mkdir subgroup
-	echo $1 > memory.limit_in_bytes
-	echo $2 > subgroup/memory.limit_in_bytes
-
-	start_memcg_process --mmap-anon -s $PAGESIZES
-
-	warmup
-	if [ $? -ne 0 ]; then
-		return
-	fi
-
-	echo $MEMCG_PROCESS_PID > tasks
-	signal_memcg_process $PAGESIZES
-	check_mem_stat "rss" $PAGESIZES
-
-	cd subgroup
-	echo $MEMCG_PROCESS_PID > tasks
-	check_mem_stat "rss" 0
-
-	# cleanup
-	cd ..
-	stop_memcg_process
-	rmdir subgroup
-}
-
-test1()
-{
-	tst_res TINFO "Test that group and subgroup have no relationship"
-	test_subgroup $PAGESIZES $((2 * PAGESIZES))
+	test_subgroup $PAGESIZES $((2*PAGESIZES))
 }
 
-test2()
+testcase_2()
 {
 	test_subgroup $PAGESIZES $PAGESIZES
 }
 
-test3()
+testcase_3()
 {
 	test_subgroup $PAGESIZES 0
 }
 
-tst_run
+run_tests
+tst_exit

+ 45 - 22
ltp/testcases/bin/memcg_usage_in_bytes_test.sh

@@ -1,35 +1,58 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+################################################################################
+#
+# File :        memcg_usage_in_bytes_test.sh
+# Description:  Tests memory.max_usage_in_bytes.
+# Author:       Peng Haitao <penght@cn.fujitsu.com>
+# History:      2012/01/16 - Created.
 #
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-MEMCG_TESTFUNC=test
-TST_CNT=2
+TCID="memcg_usage_in_bytes_test"
+TST_TOTAL=2
 
 . memcg_lib.sh
 
-MEM_TO_ALLOC=$((PAGESIZE * 1024))
-MEM_LIMIT=$((MEM_TO_ALLOC * 2))
-
-test1()
+# Test memory.usage_in_bytes
+testcase_1()
 {
-	tst_res TINFO "Test memory.usage_in_bytes"
-	test_mem_stat "--mmap-anon" $MEM_TO_ALLOC $MEM_TO_ALLOC \
-		"memory.usage_in_bytes" $MEM_TO_ALLOC false
+	test_mem_stat "--mmap-anon" $((PAGESIZE*1024)) $((PAGESIZE*1024)) \
+		"memory.usage_in_bytes" $((PAGESIZE*1024)) false
 }
 
-test2()
+# Test memory.memsw.usage_in_bytes
+testcase_2()
 {
-	tst_res TINFO "Test memory.memsw.usage_in_bytes"
-	memcg_require_memsw
+	if [ "$MEMSW_USAGE_FLAG" -eq 0 ]; then
+		tst_resm TCONF "mem+swap is not enabled"
+		return
+	fi
 
-	echo $MEM_LIMIT > memory.limit_in_bytes
-	echo $MEM_LIMIT > memory.memsw.limit_in_bytes
-	test_mem_stat "--mmap-anon" $MEM_TO_ALLOC $MEM_TO_ALLOC \
-		"memory.memsw.usage_in_bytes" $MEM_TO_ALLOC false
+	echo $((PAGESIZE*2048)) > memory.limit_in_bytes
+	echo $((PAGESIZE*2048)) > memory.memsw.limit_in_bytes
+	test_mem_stat "--mmap-anon" $((PAGESIZE*1024)) $((PAGESIZE*1024)) \
+		"memory.memsw.usage_in_bytes" $((PAGESIZE*1024)) false
 }
 
-tst_run
+run_tests
+
+tst_exit
+

+ 38 - 22
ltp/testcases/bin/memcg_use_hierarchy_test.sh

@@ -1,49 +1,62 @@
 #! /bin/sh
-# SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) 2012 FUJITSU LIMITED
-# Copyright (c) 2014-2016 Linux Test Project
-# Copyright (c) 2021 Joerg Vehlow <joerg.vehlow@aox-tech.de>
+
+################################################################################
+##                                                                            ##
+## Copyright (c) 2012 FUJITSU LIMITED                                         ##
+##                                                                            ##
+## This program is free software;  you can redistribute it and#or modify      ##
+## it under the terms of the GNU General Public License as published by       ##
+## the Free Software Foundation; either version 2 of the License, or          ##
+## (at your option) any later version.                                        ##
+##                                                                            ##
+## This program is distributed in the hope that it will be useful, but        ##
+## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
+## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
+## for more details.                                                          ##
+##                                                                            ##
+## You should have received a copy of the GNU General Public License          ##
+## along with this program;  if not, write to the Free Software               ##
+## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
+##                                                                            ##
+################################################################################
+#
+# File :        memcg_use_hierarchy_test.sh
+# Description:  Tests memory.use_hierarchy.
+# Author:       Peng Haitao <penght@cn.fujitsu.com>
+# History:      2012/01/14 - Created.
 #
-# Author: Peng Haitao <penght@cn.fujitsu.com>
 
-MEMCG_TESTFUNC=test
-TST_CNT=3
+TCID="memcg_use_hierarchy_test"
+TST_TOTAL=3
 
 . memcg_lib.sh
 
-test1()
+# test if one of the ancestors goes over its limit, the proces will be killed
+testcase_1()
 {
-	tst_res TINFO "test if one of the ancestors goes over its limit, the proces will be killed"
-
 	echo 1 > memory.use_hierarchy
 	echo $PAGESIZE > memory.limit_in_bytes
 
 	mkdir subgroup
 	cd subgroup
-	test_proc_kill $((PAGESIZE * 3)) "--mmap-lock1" $((PAGESIZE * 2)) 0
+	test_proc_kill $((PAGESIZE*3)) "--mmap-lock1" $((PAGESIZE*2)) 0
 
 	cd ..
 	rmdir subgroup
 }
 
-test2()
+# test Enabling will fail if the cgroup already has other cgroups
+testcase_2()
 {
-	tst_res TINFO "test Enabling will fail if the cgroup already has other cgroups"
-
-	memcg_require_hierarchy_disabled
-
 	mkdir subgroup
 	EXPECT_FAIL echo 1 \> memory.use_hierarchy
 
 	rmdir subgroup
 }
 
-test3()
+# test disabling will fail if the parent cgroup has enabled hierarchy.
+testcase_3()
 {
-	tst_res TINFO "test disabling will fail if the parent cgroup has enabled hierarchy"
-
-	memcg_require_hierarchy_disabled
-
 	echo 1 > memory.use_hierarchy
 	mkdir subgroup
 	EXPECT_FAIL echo 0 \> subgroup/memory.use_hierarchy
@@ -51,4 +64,7 @@ test3()
 	rmdir subgroup
 }
 
-tst_run
+run_tests
+
+tst_exit
+

+ 15 - 5
ltp/testcases/bin/meta-oe/gnome/connectivity/libnma.sh

@@ -8,20 +8,24 @@
 TST_CNT=1
 TST_SETUP=setup
 TST_TESTFUNC=test
+TST_CLEANUP=cleanup
 TST_NEEDS_TMPDIR=1
 . tst_test.sh
 
 setup()
 {
+	echo "ltp:meta-oe/gnome/connectivity//libnma.sh.libnma setup ==================="
 	#ROD apt-get update
-	ROD apt-get install  networkmanager -y --force-yes
-	ROD apt-get install  libnma -y --force-yes
+	ROD nohup apt-get install --allow-unauthenticated -y networkmanager > /opt/out.txt 2>&1
+	cat /opt/out.txt
+	ROD nohup apt-get install --allow-unauthenticated -y libnma > /opt/out.txt 2>&1
+	cat /opt/out.txt
 }
 
 test1()
 {
-	strres=`find /usr/lib -name libnma*`
-	if [[ "$strres" == "*/usr/lib/libnma.so.0.0.0*" ]]
+	strres=`find /usr/lib -name libnma* 2>&1`
+	if [[ "$strres" == */usr/lib/libnma.so.0.0.0* ]]
 	then
 		tst_res TPASS "Got correct error message"
 	else
@@ -31,4 +35,10 @@ test1()
 }
 
 
-tst_run
+cleanup()
+{
+	echo "meta-oe/gnome/connectivity//libnma.sh.libnma cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y libnma > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 11 - 2
ltp/testcases/bin/meta-oe/gnome/connectivity/network-manager-applet.sh

@@ -8,13 +8,16 @@
 TST_CNT=1
 TST_SETUP=setup
 TST_TESTFUNC=test
+TST_CLEANUP=cleanup
 TST_NEEDS_TMPDIR=1
 . tst_test.sh
 
 setup()
 {
+	echo "ltp:meta-oe/gnome/connectivity//network-manager-applet.sh.network-manager-applet setup ==================="
 	#ROD apt-get update
-	ROD apt-get install  network-manager-applet -y --force-yes
+	#ROD nohup apt-get install --allow-unauthenticated -y network-manager-applet > /opt/out.txt 2>&1
+	cat /opt/out.txt
 }
 
 test1()
@@ -24,4 +27,10 @@ test1()
 }
 
 
-tst_run
+cleanup()
+{
+	echo "meta-oe/gnome/connectivity//network-manager-applet.sh.network-manager-applet cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y network-manager-applet > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 13 - 4
ltp/testcases/bin/meta-oe/gnome/extended/gparted.sh

@@ -8,21 +8,24 @@
 TST_CNT=1
 TST_SETUP=setup
 TST_TESTFUNC=test
+TST_CLEANUP=cleanup
 TST_NEEDS_TMPDIR=1
 . tst_test.sh
 
 setup()
 {
+	echo "ltp:meta-oe/gnome/extended//gparted.sh.gparted setup ==================="
 	#ROD apt-get update
-	ROD apt-get install  gparted -y --force-yes
+	ROD nohup apt-get install --allow-unauthenticated -y gparted > /opt/out.txt 2>&1
+	cat /opt/out.txt
 }
 
 test1()
 {
 	export DISPLAY=:0.0
 	gparted &
-	strres=`ps -ef|grep gparted`
-	if [[ "$strres" == "*/usr/bin/gparted*" ]]
+	strres=`ps -ef|grep gparted 2>&1`
+	if [[ "$strres" == */usr/bin/gparted* ]]
 	then
 		tst_res TPASS "Got correct error message"
 	else
@@ -32,4 +35,10 @@ test1()
 }
 
 
-tst_run
+cleanup()
+{
+	echo "meta-oe/gnome/extended//gparted.sh.gparted cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y gparted > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 13 - 4
ltp/testcases/bin/meta-oe/gnome/gimp/babl.sh

@@ -8,19 +8,22 @@
 TST_CNT=1
 TST_SETUP=setup
 TST_TESTFUNC=test
+TST_CLEANUP=cleanup
 TST_NEEDS_TMPDIR=1
 . tst_test.sh
 
 setup()
 {
+	echo "ltp:meta-oe/gnome/gimp//babl.sh.babl setup ==================="
 	#ROD apt-get update
-	ROD apt-get install  babl -y --force-yes
+	ROD nohup apt-get install --allow-unauthenticated -y babl > /opt/out.txt 2>&1
+	cat /opt/out.txt
 }
 
 test1()
 {
-	strres=`find /usr/lib -name libbabl*`
-	if [[ "$strres" == "*/usr/lib/libbabl" ]]
+	strres=`find /usr/lib -name libbabl* 2>&1`
+	if [[ "$strres" == */usr/lib/libbabl* ]]
 	then
 		tst_res TPASS "Got correct error message"
 	else
@@ -30,4 +33,10 @@ test1()
 }
 
 
-tst_run
+cleanup()
+{
+	echo "meta-oe/gnome/gimp//babl.sh.babl cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y babl > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 13 - 6
ltp/testcases/bin/meta-oe/gnome/gimp/gegl.sh

@@ -8,21 +8,22 @@
 TST_CNT=1
 TST_SETUP=setup
 TST_TESTFUNC=test
+TST_CLEANUP=cleanup
 TST_NEEDS_TMPDIR=1
 . tst_test.sh
 
 setup()
 {
+	echo "ltp:meta-oe/gnome/gimp//gegl.sh.gegl setup ==================="
 	#ROD apt-get update
-	ROD apt-get install gegl -y --force-yes
+	ROD nohup apt-get install --allow-unauthenticated -y gegl > /opt/out.txt 2>&1
+	cat /opt/out.txt
 }
 
 test1()
 {
-	export DISPLAY=:0.0
-	gparted &
-	strres=`ps -ef|grep gparted`
-	if [[ "$strres" == "*/usr/bin/gparted*" ]]
+	strres=`gegl --list-all 2>&1`
+	if [[ "$strres" == *gegl:* ]]
 	then
 		tst_res TPASS "Got correct error message"
 	else
@@ -32,4 +33,10 @@ test1()
 }
 
 
-tst_run
+cleanup()
+{
+	echo "meta-oe/gnome/gimp//gegl.sh.gegl cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y gegl > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 36 - 0
ltp/testcases/bin/meta-oe/gnome/gimp/gimp.sh

@@ -0,0 +1,36 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gimp//gimp.sh.gegl setup ==================="
+	#ROD apt-get update
+	#ROD nohup apt-get install --allow-unauthenticated -y gegl > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+		tst_res TFAIL "Got wrong error message"
+		echo "error gimp"
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gimp//gimp.sh.gegl cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y gegl > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 42 - 0
ltp/testcases/bin/meta-oe/gnome/gimp/libmypaint.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gimp//libmypaint.sh.libmypaint setup ==================="
+	#ROD apt-get update
+	ROD nohup apt-get install --allow-unauthenticated -y libmypaint > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+	strres=`find /usr/lib -name libmypaint* 2>&1`
+	if [[ "$strres" == */usr/lib/libmypaint.so.0.0.0* ]]
+	then
+		tst_res TPASS "Got correct error message"
+	else
+		tst_res TFAIL "Got wrong error message"
+		echo $strres
+	fi
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gimp//libmypaint.sh.libmypaint cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y libmypaint > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 42 - 0
ltp/testcases/bin/meta-oe/gnome/gimp/mypaint-brushes-1.0.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gimp//mypaint-brushes-1.0.sh.mypaint-brushes-1.0 setup ==================="
+	#ROD apt-get update
+	ROD nohup apt-get install --allow-unauthenticated -y mypaint-brushes-1.0 > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+	strres=`dpkg -L mypaint-brushes-1.0 2>&1`
+	if [[ "$strres" == */usr/share/mypaint-data/1.0/brushes/classic/brush_prev.png* ]]
+	then
+		tst_res TPASS "Got correct error message"
+	else
+		tst_res TFAIL "Got wrong error message"
+		echo $strres
+	fi
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gimp//mypaint-brushes-1.0.sh.mypaint-brushes-1.0 cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y mypaint-brushes-1.0 > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 42 - 0
ltp/testcases/bin/meta-oe/gnome/gnome/amtk.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gnome//amtk.sh.amtk setup ==================="
+	#ROD apt-get update
+	ROD nohup apt-get install --allow-unauthenticated -y amtk > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+	strres=`find /usr/lib -name libamtk* 2>&1`
+	if [[ "$strres" == */usr/lib/libamtk-5.so.0.0.0* ]]
+	then
+		tst_res TPASS "Got correct error message"
+	else
+		tst_res TFAIL "Got wrong error message"
+		echo $strres
+	fi
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gnome//amtk.sh.amtk cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y amtk > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 42 - 0
ltp/testcases/bin/meta-oe/gnome/gnome/dconf-editor.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gnome//dconf-editor.sh.dconf-editor setup ==================="
+	#ROD apt-get update
+	ROD nohup apt-get install --allow-unauthenticated -y dconf-editor > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+	strres=`dconf-editor -v 2>&1`
+	if [[ "$strres" == *dconf-editor 3.36.2* ]]
+	then
+		tst_res TPASS "Got correct error message"
+	else
+		tst_res TFAIL "Got wrong error message"
+		echo $strres
+	fi
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gnome//dconf-editor.sh.dconf-editor cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y dconf-editor > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 42 - 0
ltp/testcases/bin/meta-oe/gnome/gnome/dconf.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gnome//dconf.sh.dconf setup ==================="
+	#ROD apt-get update
+	ROD nohup apt-get install --allow-unauthenticated -y dconf > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+	strres=`dconf help 2>&1`
+	if [[ "$strres" == *dconf COMMAND* ]]
+	then
+		tst_res TPASS "Got correct error message"
+	else
+		tst_res TFAIL "Got wrong error message"
+		echo $strres
+	fi
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gnome//dconf.sh.dconf cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y dconf > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 42 - 0
ltp/testcases/bin/meta-oe/gnome/gnome/devilspie2.sh

@@ -0,0 +1,42 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gnome//devilspie2.sh.devilspie2 setup ==================="
+	#ROD apt-get update
+	ROD nohup apt-get install --allow-unauthenticated -y devilspie2 > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+	strres=`devilspie2 -v 2>&1`
+	if [[ "$strres" == *Devilspie2 v* ]]
+	then
+		tst_res TPASS "Got correct error message"
+	else
+		tst_res TFAIL "Got wrong error message"
+		echo $strres
+	fi
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gnome//devilspie2.sh.devilspie2 cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y devilspie2 > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 36 - 0
ltp/testcases/bin/meta-oe/gnome/gnome/evince.sh

@@ -0,0 +1,36 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gnome//evince.sh.evince setup ==================="
+	#ROD apt-get update
+	#ROD nohup apt-get install --allow-unauthenticated -y evince > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+		tst_res TFAIL "Got wrong error message"
+		echo "error evince"
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gnome//evince.sh.evince cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y evince > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

+ 36 - 0
ltp/testcases/bin/meta-oe/gnome/gnome/evolution-data-server-native.sh

@@ -0,0 +1,36 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) International Business Machines Corp., 2001
+# Author: Manoj Iyer <manjo@mail.utexas.edu>
+#
+# Basic mkdir tests
+
+TST_CNT=1
+TST_SETUP=setup
+TST_TESTFUNC=test
+TST_CLEANUP=cleanup
+TST_NEEDS_TMPDIR=1
+. tst_test.sh
+
+setup()
+{
+	echo "ltp:meta-oe/gnome/gnome//evolution-data-server-native.sh.evolution-data-server-native setup ==================="
+	#ROD apt-get update
+	#ROD nohup apt-get install --allow-unauthenticated -y evolution-data-server-native > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+
+test1()
+{
+		tst_res TFAIL "Got wrong error message"
+		echo "error evolution-data-server-native"
+}
+
+
+cleanup()
+{
+	echo "meta-oe/gnome/gnome//evolution-data-server-native.sh.evolution-data-server-native cleanup ==================="
+	#ROD nohup apt-get remove --allow-unauthenticated -y evolution-data-server-native > /opt/out.txt 2>&1
+	cat /opt/out.txt
+}
+tst_run

Some files were not shown because too many files changed in this diff