import re


def check_voltage(regulator, voltage):
    r = re.compile(r" +{} ".format(regulator))
    for line in open('/sys/kernel/debug/regulator/regulator_summary').readlines():
        if r.match(line):
            val = line.split()[5]
            assert(val == "{}mV".format(voltage))
            return
    assert(False)


# This is true until the GPU does DVFS
def test_gpu_regulator():
    check_voltage("buck3", 900)
