Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test-wrapper.dhall 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. let Test = ./test.dhall ? env:DHALL_GENODE_TEST
  2. let Genode = Test.Genode
  3. let Prelude = Genode.Prelude
  4. let XML = Prelude.XML
  5. let Init = Genode.Init
  6. let Child = Init.Child
  7. let TextMapType = Prelude.Map.Type Text
  8. let Children = TextMapType Child.Type
  9. let Manifest/Type = TextMapType (TextMapType Text)
  10. let Manifest/toRoutes =
  11. λ(manifest : Manifest/Type) →
  12. Prelude.List.map
  13. (Prelude.Map.Entry Text Text)
  14. Init.ServiceRoute.Type
  15. ( λ(entry : Prelude.Map.Entry Text Text) →
  16. { service =
  17. { name = "ROM"
  18. , label = Init.LabelSelector.Type.Last entry.mapKey
  19. }
  20. , route =
  21. Init.Route.Type.Child
  22. { name = "store_rom"
  23. , label = Some entry.mapValue
  24. , diag = None Bool
  25. }
  26. }
  27. )
  28. ( Prelude.List.concat
  29. (Prelude.Map.Entry Text Text)
  30. (Prelude.Map.values Text (Prelude.Map.Type Text Text) manifest)
  31. )
  32. let parentROMs =
  33. Prelude.List.map
  34. Text
  35. Init.ServiceRoute.Type
  36. ( λ(label : Text) →
  37. { service =
  38. { name = "ROM", label = Init.LabelSelector.Type.Last label }
  39. , route =
  40. Init.Route.Type.Parent { label = Some label, diag = None Bool }
  41. }
  42. )
  43. let wrapHarness
  44. : Children → Manifest/Type → Child.Type
  45. = λ(children : Children) →
  46. λ(manifest : Manifest/Type) →
  47. Child.nested
  48. children
  49. Child.Attributes::{
  50. , binary = "sotest-harness"
  51. , exitPropagate = True
  52. , resources = Init.Resources::{ ram = Genode.units.MiB 4 }
  53. , routes =
  54. [ Init.ServiceRoute.parentLabel
  55. "LOG"
  56. (Some "SOTEST")
  57. (Some "unlabeled")
  58. , Init.ServiceRoute.parent "IO_MEM"
  59. , Init.ServiceRoute.parent "IO_PORT"
  60. , Init.ServiceRoute.parent "IRQ"
  61. , Init.ServiceRoute.parent "VM"
  62. , Init.ServiceRoute.child "Timer" "timer"
  63. , Init.ServiceRoute.child "Rtc" "rtc"
  64. , Init.ServiceRoute.child "File_system" "store_fs"
  65. ]
  66. # parentROMs
  67. [ "ld.lib.so"
  68. , "init"
  69. , "platform_info"
  70. , "core_log"
  71. , "kernel_log"
  72. , "vfs"
  73. , "libvfs.so"
  74. , "cached_fs_rom"
  75. ]
  76. # Manifest/toRoutes manifest
  77. }
  78. in λ(test : Test.Type) →
  79. λ(storeSize : Natural) →
  80. λ(storeManifest : Manifest/Type) →
  81. λ(bootManifest : Manifest/Type) →
  82. Genode.Boot::{
  83. , config = Init::{
  84. , children =
  85. [ { mapKey = "timer"
  86. , mapValue =
  87. Child.flat
  88. Child.Attributes::{
  89. , binary = "timer_drv"
  90. , provides = [ "Timer" ]
  91. }
  92. }
  93. , { mapKey = "rtc"
  94. , mapValue =
  95. Child.flat
  96. Child.Attributes::{
  97. , binary = "rtc_drv"
  98. , provides = [ "Rtc" ]
  99. , routes = [ Init.ServiceRoute.parent "IO_PORT" ]
  100. }
  101. }
  102. , { mapKey = "store_fs"
  103. , mapValue =
  104. Child.flat
  105. Child.Attributes::{
  106. , binary = "vfs"
  107. , config = Init.Config::{
  108. , content =
  109. [ XML.element
  110. { name = "vfs"
  111. , attributes = XML.emptyAttributes
  112. , content =
  113. [ XML.leaf
  114. { name = "tar"
  115. , attributes = toMap { name = "store.tar" }
  116. }
  117. ]
  118. }
  119. ]
  120. , defaultPolicy = Some Init.Config.DefaultPolicy::{
  121. , attributes = toMap { root = "/", writeable = "no" }
  122. }
  123. }
  124. , provides = [ "File_system" ]
  125. }
  126. }
  127. , { mapKey = "store_rom"
  128. , mapValue =
  129. Child.flat
  130. Child.Attributes::{
  131. , binary = "cached_fs_rom"
  132. , provides = [ "ROM" ]
  133. , resources = Init.Resources::{
  134. , ram = storeSize + Genode.units.MiB 1
  135. }
  136. , routes =
  137. [ Init.ServiceRoute.child "File_system" "store_fs" ]
  138. }
  139. }
  140. , { mapKey = "harness"
  141. , mapValue = wrapHarness test.children storeManifest
  142. }
  143. ]
  144. }
  145. , rom =
  146. test.rom
  147. # Genode.BootModules.toRomPaths
  148. ( Prelude.List.concat
  149. (Prelude.Map.Entry Text Text)
  150. ( Prelude.Map.values
  151. Text
  152. (Prelude.Map.Type Text Text)
  153. bootManifest
  154. )
  155. )
  156. }