github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/internal/platform/mmap_linux_test.go (about)

     1  package platform
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/wasilibs/wazerox/internal/testing/require"
     8  )
     9  
    10  func TestHugePageConfigs(t *testing.T) {
    11  	dirents, err := os.ReadDir("/sys/kernel/mm/hugepages/")
    12  	require.NoError(t, err)
    13  	require.Equal(t, len(dirents), len(hugePagesConfigs))
    14  
    15  	for _, hugePagesConfig := range hugePagesConfigs {
    16  		require.NotEqual(t, 0, hugePagesConfig.size)
    17  		require.NotEqual(t, 0, hugePagesConfig.flag)
    18  	}
    19  
    20  	for i := 1; i < len(hugePagesConfigs); i++ {
    21  		require.True(t, hugePagesConfigs[i-1].size > hugePagesConfigs[i].size)
    22  	}
    23  }