github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/platform/mmap_linux_test.go (about)

     1  package platform
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/tetratelabs/wazero/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  }